Amaury Forgeot d'Arc added the comment: I managed to reproduce the problem consistently with the following code:
import ctypes, sys, time, thread
# Module globals are cleared before __del__ is run
# So save the functions in class dict
class C:
ensure = ctypes.pythonapi.PyGILState_Ensure
release = ctypes.pythonapi.PyGILState_Release
def __del__(self):
state = self.ensure()
self.release(state)
def waitingThread():
x = C()
time.sleep(100)
thread.start_new_thread(waitingThread, ())
time.sleep(1)
sys.exit(42)
On exit, PyInterpreterState_Clear stops the sleeping thread and free its
local variables. But at this time _PyGILState_Fini has already been
called...
The initial patch also corrects this problem. I join another patch,
which adds the above code in a testcase.
Ready to check-in, but can someone have a look?
----------
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file8798/test_gilstate.patch
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1402>
__________________________________
test_gilstate.patch
Description: Binary data
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
