[Stackless] Cannot re-initialize Python

Mark Gants mgants4 at hotmail.com
Mon Feb 16 15:11:18 CET 2009

Ah, that's pretty disappointing - I was hoping that Python would be 'tighter' than that. Although I appreciate the feedback - thank you.

As a follow up:

Since Python (at this time) cannot be cleanly re-initialized, would it be valid / sane to just create and destroy new sub-interpreters as needed?

So, instead of calling Py_Finalize() and Py_Initialize() to re-init Python, is it acceptable to use Py_NewInterpreter() and Py_EndInterpreter() 
to achieve a similar effect? Barring the obvious bugs/caveats in the documentation, is there anything especially bad or wasteful about this?

I am also curious (and would appreciate a response) - how do the guys at CCP manage this type of situation? Or is it not a problem?


Mark Gants 

---------- Forwarded message ----------
From: OvermindDL1 <overminddl1 at gmail.com>
Date: Sat, Feb 14, 2009 at 6:10 PM
Subject: Re: [Stackless] Cannot re-initialize Python
To: Richard Tew <richard.m.tew at gmail.com>
On Sat, Feb 14, 2009 at 8:17 AM, Richard Tew <richard.m.tew at gmail.com> wrote:
> On Sat, Feb 14, 2009 at 9:03 AM, Mark Gants <mgants4 at hotmail.com> wrote:
>> 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.
> ...
>> 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.
> There is no reason to believe it would be fixed in 3.0, as no explicit
> fixes have been made for this.
I ran into this myself long ago as well.  As such I came up with the
fact that Python was not designed, nor will ever be designed to be
cleanly shutdown, it just will not clean up well, it expects the
program to shut down as soon as it shuts down, so the program shutdown
will clean the rest up.  As such, it will never re-init well as well,
not without some major patching anyway.
It has nothing to do with Stackless though, this is a pure Python annoyance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20090216/6da70a95/attachment.htm>

More information about the Stackless mailing list