[issue40075] _tkinter PythonCmd fails to acquire GIL

Steve Dower report at bugs.python.org
Wed Jul 29 17:25:44 EDT 2020


Steve Dower <steve.dower at python.org> added the comment:

At a glance, it looks like ENTER_PYTHON will *restore* the GIL on the current thread, but it may be coming in on a thread that's never seen the GIL before.

"The GIL" is actually the Python thread state, which is actually a per-thread data structure that's either active/locked or inactive/unlocked. If the current thread doesn't have a thread state, PyGILState_Ensure will create one, while ENTER_PYTHON will not.

So the underlying issue is probably that the callbacks are coming in from a thread that they shouldn't be, and really ought to be marshalled back into the correct event loop first.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40075>
_______________________________________


More information about the Python-bugs-list mailing list