From 3924a3da10145ede4a831a58ac184d3658d48aca Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 8 Feb 2009 21:16:29 -0400 Subject: pyinterp.cc shares global session; accept full paths passed to --import. --- src/global.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/global.cc') diff --git a/src/global.cc b/src/global.cc index 939a51b2..4d2f97fc 100644 --- a/src/global.cc +++ b/src/global.cc @@ -39,7 +39,14 @@ global_scope_t::global_scope_t(char ** envp) { TRACE_CTOR(global_scope_t, ""); - session_ptr.reset(new LEDGER_SESSION_T); +#if defined(HAVE_BOOST_PYTHON) + if (! python_session.get()) { + python_session.reset(new ledger::python_interpreter_t); + session_ptr = python_session; + } +#else + session_ptr.reset(new session_t); +#endif set_session_context(session_ptr.get()); @@ -75,6 +82,10 @@ global_scope_t::~global_scope_t() // object, and then shutting down the memory tracing subsystem. // Otherwise, let it all leak because we're about to exit anyway. IF_VERIFY() set_session_context(NULL); + +#if defined(HAVE_BOOST_PYTHON) + python_session.reset(); +#endif } void global_scope_t::read_init() -- cgit v1.2.3