summaryrefslogtreecommitdiff
path: root/python.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-14 05:14:58 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-14 05:14:58 -0400
commit0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27 (patch)
treea021447b83f7aff6c0072124a53b330242b55539 /python.cc
parentbd72c0cf908492abb99a1419f7f8136729747061 (diff)
downloadfork-ledger-0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27.tar.gz
fork-ledger-0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27.tar.bz2
fork-ledger-0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27.zip
ledger.so can now call back to functions in the calling interpretor (see main.py)
Diffstat (limited to 'python.cc')
-rw-r--r--python.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/python.cc b/python.cc
index 288825aa..980df95c 100644
--- a/python.cc
+++ b/python.cc
@@ -27,6 +27,8 @@ namespace ledger {
python_support * python_interpretor = NULL;
+#ifndef PYTHON_MODULE
+
static struct cleanup_python {
~cleanup_python() {
if (python_interpretor) {
@@ -56,14 +58,18 @@ void init_module()
export_datetime();
}
+#endif // PYTHON_MODULE
+
void init_python()
{
assert(! python_interpretor);
+#ifndef PYTHON_MODULE
Py_Initialize();
- python_interpretor = new python_support;
-
detail::init_module("ledger", &init_module);
+#endif
+
+ python_interpretor = new python_support;
}
} // namespace ledger