PyFinalize problem from multiple DLLs - a possible work-around
paul at fxtech.com
Sun Oct 20 16:55:59 CEST 2002
Hi folks. We're embedding Python and have come across a conflict when
multiple DLLs that link to Python are used. Here is the scenario:
Although neither Extension knows about the other, they both link to
python, which seems to be sharing its global state between the two. This
causes problems when we do this:
PyFinalize <--- oops
The first call to PyFinalize is cleaning everthing up, so the second
PyFinalize (or, Py_EndInterpreter) causes a critical exit error.
I think I have worked around the problem, however, by turning the static
initialized variable in pythonrun.c into a counter. PyInitialize
increments the counter, and initializes when it is 1. PyFinalize
decrements the counter, and cleans up when it reaches 0.
1. confirm this problem really exists
2. agree my solution probably fixes it (I have the code to proove it)
3. tell me where to submit the patch?
Thanks a lot!
More information about the Python-list