New submission from Thomas Holder <thomas.hol...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue40075>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to