Py_Initialize / Py_Finalize crash

Julien Keable julien.keable at polymtl.ca
Wed Nov 21 13:28:51 EST 2001


Hello,

I'm trying to run python scripts from a c++ program. I need to have a
fresh interpreter everytime I run a script, because the script can be
modified between two runs (think of my program as a debugger). It works,
but after 7-8 runs, python breaks on a invalid DECREF (internal to
python code) or something like that. After trying to pinpoint the
problem, I came up with this rather simple snippet, which still produces
the error:

for(int i=0;i<1000;i++)
{
	Py_Initialize();
	Py_Finalize();
}

I'm using python 2.0 debug version. 

Is there another way I can "reset" the interpreter state without having
to call initialize and finalize?

Julien Keable



More information about the Python-list mailing list