diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-08 21:16:29 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-08 21:16:29 -0400 |
commit | 3924a3da10145ede4a831a58ac184d3658d48aca (patch) | |
tree | 3384088b961869f75ed60268f3145cec67b7fa36 /python/pyledger.cc | |
parent | d4d7090f3c673f092fdc2bba54e41582c85cff8b (diff) | |
download | ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.gz ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.bz2 ledger-3924a3da10145ede4a831a58ac184d3658d48aca.zip |
pyinterp.cc shares global session; accept full paths passed to --import.
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(); } |