diff options
Diffstat (limited to 'python/pyinterp.h')
-rw-r--r-- | python/pyinterp.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/python/pyinterp.h b/python/pyinterp.h index cf9ee486..df0e00dd 100644 --- a/python/pyinterp.h +++ b/python/pyinterp.h @@ -44,15 +44,22 @@ class python_interpreter_t : public session_t { public: boost::python::dict main_nspace; + bool is_initialized; - python_interpreter_t(); - + python_interpreter_t() + : session_t(), main_nspace(), is_initialized(false) { + TRACE_CTOR(python_interpreter_t, ""); + } + virtual ~python_interpreter_t() { TRACE_DTOR(python_interpreter_t); - Py_Finalize(); + if (is_initialized) + Py_Finalize(); } + void initialize(); + boost::python::object import(const string& name); enum py_eval_mode_t { |