[IPython-user] c++ destructors not called

Fernando Perez fperez.net@gmail....
Thu Nov 22 15:03:12 CST 2007

On Oct 28, 2007 4:58 PM, Malte Marquarding <Malte.Marquarding@csiro.au> wrote:
> Hi,
> I have a c++ object that creates temporary files, which are deleted
> in the destructor. I am using these in python via boost::python
> wrappers.
> When running the python interpreter (directly) everything gets
> cleaned up properly on exit. However, when exiting ipython the
> destructor never gets called.
> Unfortunately it is a bit hard to provide a test case, that's why I
> thought I ask first if someone else has seen this.

Mmh, I suppose the silence is an indicator that nobody has  any good ideas :)

Honestly I find it quite strange, since when ipython dies, the
underlying python interpreter eventually also quits. IPython is
nothing more than another python script that happens to implement a
read-eval loop, taking your input from the command line, compiling it
and executing it until you hit Ctrl-D or ask for an exit.  It does
register a bit of cleanup with the atexit module and it installs
custom signal handlers, but I fail to see how either of those two
things should interfere with the python VM calling C++ destructors.

Anyone with a suggestion or idea as to what could be going on here?



More information about the IPython-user mailing list