Safe to call Py_Initialize() frequently?
Mark Hammond
skippy.hammond at gmail.com
Mon Mar 23 07:00:11 EDT 2009
On 23/03/2009 12:14 PM, Graham Dumpleton wrote:
> On Mar 21, 10:27 am, Mark Hammond<skippy.hamm... at gmail.com> wrote:
>> Calling
>> Py_Initialize and Py_Finalize multiple times does leak (Python 3 has
>> mechanisms so this need to always be true in the future, but it is true
>> now for non-trivial apps.
>
> Mark, can you please clarify this statement you are making. The
> grammar used makes it a bit unclear.
Yes, sorry - s/this need to/this need not/
> Are you saying, that effectively by design, Python 3.0 will always
> leak memory upon Py_Finalize() being called, or that it shouldn't leak
> memory and that problems with older versions of Python have been fixed
> up?
The latter - kindof - py3k provides an enhanced API that *allows*
extensions to be 'safe' in this regard, but it doesn't enforce it.
Modules 'trivially' ported from py2k will not magically get this ability
- they must explicitly take advantage of it. pywin32 is yet to do so
(ie, it is a 'trivial' port...)
I hope this clarifies...
Mark
More information about the Python-list
mailing list