diff options
Diffstat (limited to 'python/pyledger.cc')
-rw-r--r-- | python/pyledger.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/python/pyledger.cc b/python/pyledger.cc index 1a5b42f4..963efe11 100644 --- a/python/pyledger.cc +++ b/python/pyledger.cc @@ -33,14 +33,18 @@ using namespace boost::python; -ledger::python_interpreter_t python_session; - namespace ledger { extern void initialize_for_python(); } BOOST_PYTHON_MODULE(ledger) { - ledger::set_session_context(&python_session); - ledger::initialize_for_python(); + using namespace ledger; + + if (! python_session.get()) + python_session.reset(new python_interpreter_t); + + set_session_context(python_session.get()); + + initialize_for_python(); } |