[Python-bugs-list] [Bug #131207] Fatal Python Error during program shutdown

noreply@sourceforge.net noreply@sourceforge.net
Fri, 09 Feb 2001 15:34:40 -0800


Bug #131207, was updated on 2001-Feb-05 18:50
Here is a current snapshot of the bug.

Project: Python
Category: Tkinter
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: djhender
Assigned to : effbot
Summary: Fatal Python Error during program shutdown

Details: The windows builds of versions 2.0 and 2.1a2 contain an
intermittent bug which often appears when a script using Tkinter stops by
calling self.tk.quit() and sometimes (less often) appears following a
<Destroy> event or call to a ?.destory() function.
Under Windows 98SE, this results in a GPF.
Under Windows 2000, a message to the console window shows "Fatal Python
Error", "PyEval_RestoreThread NULL tstate".

The following script demonstrates the problem:
---------------------
# BugDemo.py

from Tkinter import *

class BugDemo(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        Button(self, text='Hi', command=self.hi).pack()
        Button(self, text='Quit', command=self.tk.quit).pack()
    def hi(self):
        print "hi"

bd = BugDemo(Tk())
bd.pack()
bd.mainloop()
----------------------
Execute in console window: "c:> python BugDemo.py"
Test this by 1) clicking Quit button 2) clicking Hi button, then Quit
button.
Test 1: The script runs successfully most of the time. I found I had to
minimize and restore its window to make it fail regularly.
Test 2: I need to click Hi button before clicking the Quit button. Then it
failed about half the time.

The problem appears to occur after the script has completed, during some
kind of cleanup perhaps. The more useful error message on the Win2k machine
may help to locate the problem.

Problem also manifests using the PythonWare 2.0 release on Win98.

Follow-Ups:

Date: 2001-Feb-09 15:34
By: tim_one

Comment:
Assigned to /F, under the theory he can confirm that "this kind of thing"
is still a general problem with Tk we can't do anything about.
-------------------------------------------------------

Date: 2001-Feb-05 21:30
By: djhender

Comment:
See also #116289 (and my comment to it) which describes what often happened
to my 'real' programs which lead to developing the above BugDemo script. My
'real' programs were developed over the last two years or so, and worked in
Jan 2000 with 1.5.2. I upgraded the Python version recently, and then
started working on these programs again. It was "WTF is wrong with my
code", until I found the same problem showing up in the small test cases.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=131207&group_id=5470