Safe to call Py_Initialize() frequently?
robert.oschler at gmail.com
Sat Mar 21 04:35:28 CET 2009
On Mar 20, 7:27 pm, Mark Hammond <skippy.hamm... at gmail.com> wrote:
> On 21/03/2009 4:20 AM, roschler wrote:
> Calling Py_Initialize() multiple times has no effect. 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.
> > If it is not a safe approach, is there another way to get what I want?
> Start a new process each time?
Thank you for your reply. I didn't know that Py_Initialize worked
How about using Py_NewInterpreter() and Py_EndInterpreter() with each
job? Any value in that approach? If not, is there at least a
reliable way to get a list of all active threads and terminate them so
before starting the next job? Starting a new process each time seems
a bit heavy handed.
More information about the Python-list