[New-bugs-announce] [issue40075] _tkinter PythonCmd fails to acquire GIL
Thomas Holder
report at bugs.python.org
Thu Mar 26 08:16:09 EDT 2020
New submission from Thomas Holder <thomas.holder at schrodinger.com>:
The attached demo application runs a Tkinter GUI and a PyQt GUI in the same thread. PyQt owns the main loop and keeps updating the Tkinter instance by calling `update()`.
On Windows, when binding a "<Configure>" event, resizing the Tk window will lead to a crash:
```
Fatal Python error: PyEval_RestoreThread: NULL tstate
Current thread 0x00001f1c (most recent call first):
File "qt_tk_demo.py", line 50 in <module>
```
This crash happens in `_tkinter.c` in `PythonCmd` inside the `ENTER_PYTHON` macro.
The issue can be fixed by using `PyGILState_Ensure` and `PyGILState_Release` instead of the `ENTER_PYTHON` macro inside the `PythonCmd` function.
----------
components: Tkinter, Windows
files: qt_tk_demo.py
messages: 365064
nosy: Thomas Holder, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: _tkinter PythonCmd fails to acquire GIL
type: crash
Added file: https://bugs.python.org/file49002/qt_tk_demo.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40075>
_______________________________________
More information about the New-bugs-announce
mailing list