homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients amaury.forgeotdarc, jnoller, nirai, pitrou, vstinner
Date 2010年01月13日.01:45:18
SpamBayes Score 7.71605e-15
Marked as misclassified No
Message-id <1263347123.16.0.661832935415.issue7544@psf.upfronthosting.co.za>
In-reply-to
Content
> Running the tests in debug mode gives the following error:
> ... Fatal Python error: Invalid thread state for this thread
I tried all Lib/test/test_thread*py, but not in debug mode :-/
The problem is here: PyThreadState_New() -> _PyGILState_NoteThreadState() -> PyThread_set_key_value() -> find_key() and find_key() calls PyThread_get_thread_ident(), but the ident is not the right ident :-/
PyThreadState_New() should not call _PyGILState_NoteThreadState(), it should be done _in_ the thread.
I wrote a new patch fixing the unit test. PyThreadState_New() is part of the public API, so I can't change its prototype. And _PyGILState_NoteThreadState() is a private function (use the "static" keyword). Because of that, I introduced two new functions:
 - PyThreadState_Prealloc(): like PyThreadState_New() but for thread preallocation, can be called outside the new state (from another thread)
 - PyThreadState_Init(): have to be called in the new thread to finish the thread state initialization, only required for state created by PyThreadState_Prealloc() (not for PyThreadState_New())
I tried all Lib/test/test_thread*.py tests in debug mode and all test now pass ;-)
History
Date User Action Args
2010年01月13日 01:45:23vstinnersetrecipients: + vstinner, amaury.forgeotdarc, pitrou, jnoller, nirai
2010年01月13日 01:45:23vstinnersetmessageid: <1263347123.16.0.661832935415.issue7544@psf.upfronthosting.co.za>
2010年01月13日 01:45:22vstinnerlinkissue7544 messages
2010年01月13日 01:45:21vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /