[Stackless] Cannot re-initialize Python

Mark Gants mgants4 at hotmail.com
Sat Feb 14 15:03:23 CET 2009


Hi,

I have embedded Stackless Python 2.6.1 into a C++ application of mine. At certain points in the application I would like to 're-init' Python to clean things up without having to shutdown and re-launch my application. First time initializing Python works fine. I encounter a crash though when trying to initialize Python a second time.

I am doing something like the following:

if (!Py_IsInitialized())
{
    Py_SetProgramName( /* some name */ );
    Py_Initialize();
}

// ...do some app stuff...

// ...and at some point...

if (Py_IsInitialized())
{
    // Try to re-initialize python
    Py_Finalize();
    Py_SetProgramName( /* some name */ );

    Py_Initialize();  // <--- Crashes here
}

I did some searching and found that I am having the same problem as described in these links:

http://bugs.python.org/issue1306
http://osdir.com/ml/python.stackless/2006-03/msg00023.html

Does anyone know if this issue has been addressed in Stackless Python 3.0? I would like to use v3.0, but chose v2.6.1 due to the warnings about bugs in v3.0.

Thank you, I appreciate it.

Mark

P.S. Sorry if this subject has already been discussed. I searched the list, but found no results.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090214/4713b1b6/attachment.htm>


More information about the Stackless mailing list