[C++-sig] application exit and shared_ptr
Philip Winston
pwinston at gmail.com
Wed Jul 30 05:14:18 CEST 2008
I understand it is not possible to call Py_Finalize with Boost.Python.
But is it possible to manually delete all variables from an embedded
interactive interpreter? Would this be a way to to cause Python to
release any shared_ptrs it is holding on to?
So we return shared_ptrs from our API. But at exit (and possibly
other times) we'd like to reset the interpreter, so it's no longer
holding any shared_ptrs, so those objects are free to be deleted if no
other references are held.
Some specific excerpts (any other advice welcome):
excerpts:
m_mainmodule = import("__main__");
m_namespace = m_mainmodule.attr("__dict__");
exec("import PyInteractive");
exec("__pyInteractiveExec = PyInteractive.PyInteractive().executeline");
m_interactive = extract<object>(m_namespace["__pyInteractiveExec"]);
then we repeatedly call:
m_interactive(string);
S now we'd like to delete all objects the user created interactively
at the prompt.
Thanks.
Philip Winston
pwinston at gmail.com
More information about the Cplusplus-sig
mailing list