Author epaine
Recipients epaine, paul.moore, serhiy.storchaka, speleo3, steve.dower, tim.golden, zach.ware
Date 2020-07-30.09:56:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1596102962.59.0.393420424359.issue40075@roundup.psfhosted.org>
In-reply-to
Content
Thanks Steve for your explanation. I had a quick experiment with the ENTER_PYTHON definition and initially just added a call to PyThreadState_Get if the tstate was NULL. This still crashed the interpreter with the following error (which I think reaffirms Steve's explanation):

Fatal Python error: PyThreadState_Get: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)

To work-around this error, I temporarily acquired the GIL and then released it after the call to PyThreadState_Get. The result worked correctly and can be found in the attached diff. I am not saying that the attached diff is the solution, but I don't think we need to stop using tstate in favour of the gstate introduced in the PR.

> I could not reproduce the crash without showing any non-tk dialog.

That would help explain why I cannot reproduce it on Linux - it is differences in the windowing API under Tcl not some platform-specific code in Tcl/Tk or _tkinter.
History
Date User Action Args
2020-07-30 09:56:02epainesetrecipients: + epaine, paul.moore, tim.golden, zach.ware, serhiy.storchaka, steve.dower, speleo3
2020-07-30 09:56:02epainesetmessageid: <1596102962.59.0.393420424359.issue40075@roundup.psfhosted.org>
2020-07-30 09:56:02epainelinkissue40075 messages
2020-07-30 09:56:02epainecreate