From 0b0c9b5bd13b1dedf100b137e3a35be60d3d3a27 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 14 Sep 2004 05:14:58 -0400 Subject: ledger.so can now call back to functions in the calling interpretor (see main.py) --- python.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'python.cc') 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 -- cgit v1.2.3