New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wait_variable hangs at exit #40440
Comments
If code is waiting on a wait_variable at program exit then the program never fully exits. The command prompt never returns and the process doesn't seem to be doing much of anything (i.e. no heavy CPU usage). ctrl-C has no effect. I have found that binding to <Detroy> does work around the problem. I saw this using a unix/X11 build of Python 2.3.4 on MacOS X 10.3.4 and also the standard Python 2.3 framework build included with MacOS X 10.3. The attached file gives a good example. To see the problem, execute the script and then close the root window before the script finishes (you have 10 seconds). |
Confirmed on Linux (closing after 'script 2'): trunk-py$ ./python WaitTest.py |
You can also reproduce it with a shorter test that doesn't need any import Tkinter
root = Tkinter.Tk()
waitvar = Tkinter.BooleanVar()
root.after(50, lambda: waitvar.set(True))
root.after(10, root.destroy)
root.wait_variable(waitvar)
root.mainloop() Verifying. |
Patch attached, but didn't test it at all. This is a trick so it doesn't |
Using this patch I noticed two problems appeared when running WaitTest.py
|
Ah.. number 2 is problematic. Before continuing lets reduce the previous import Tkinter
root = Tkinter.Tk()
waitVar = Tkinter.BooleanVar()
root.after(3000, lambda: waitVar.set(True))
root.wait_variable(waitVar) When you run this, it will schedule the call to this lambda to happen 3 So what I did here, and I'm not sure if it would be accepted or not, was Note that even though PythonCmd_Error set errInCmd to 1, it was never |
In 3.2, winxp, (with Tkinter => tkinter), I get |
Confirmed on Python 3.11.0a3+, assuming older versions also affected. This issue has different versions of tests to confirm it, but I think not in a test suite-friendly format yet. There's also a patch and detailed analysis by gpolo indicating that it might need editing _tkinter.c to handle fallout from his proposed Python-side patch. |
is this still an issue? |
Try a test if you want. 'devdanzin' already confirmed for 3.11 and I don't know of a fix. 3.12 uses tk 8.6.13 on Windows and that might have an effect. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: