summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-08 21:16:29 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-08 21:16:29 -0400
commit3924a3da10145ede4a831a58ac184d3658d48aca (patch)
tree3384088b961869f75ed60268f3145cec67b7fa36 /src
parentd4d7090f3c673f092fdc2bba54e41582c85cff8b (diff)
downloadfork-ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.gz
fork-ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.bz2
fork-ledger-3924a3da10145ede4a831a58ac184d3658d48aca.zip
pyinterp.cc shares global session; accept full paths passed to --import.
Diffstat (limited to 'src')
-rw-r--r--src/global.cc13
-rw-r--r--src/global.h2
2 files changed, 13 insertions, 2 deletions
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()
diff --git a/src/global.h b/src/global.h
index 85745ba2..0851cdaa 100644
--- a/src/global.h
+++ b/src/global.h
@@ -44,7 +44,7 @@ namespace ledger {
class global_scope_t : public noncopyable, public scope_t
{
- scoped_ptr<session_t> session_ptr;
+ shared_ptr<session_t> session_ptr;
ptr_list<report_t> report_stack;
public: