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
Tkinter-related segfault on macOS (regression between 3.7.0 and 3.7.1rc1) #79108
Comments
After switching from Python 3.7.0 to 3.7.1rc1 (macOS, 64-bit only downloaded from python.org), my rather big Tkinter application started to segfault whenever I close a system dialog (eg. the one created by askopenfilename or showerror) by keypress (eg. Escape or Enter). The crash does not happen when I close the dialog with mouse click. The code that calls the dialog runs fine, and the crash seems to happen next time the control goes back to Tk mainloop. It looks like the keypress performed in the dialog somehow remains in Tk event queue. Here is the system log for main thread, (more detailed information can be seen at https://bitbucket.org/plas/thonny/issues/545/quit): Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) VM Regions Near 0: Thread 0 Crashed:: Dispatch queue: com.apple.main-thread |
Here is a simple application that also exposes this problem. Click at the button and press Escape when dialog appears. import tkinter as tk
import tkinter.filedialog as fd
root = tk.Tk()
def dostuff():
fd.askopenfile()
bt = tk.Button(root, text="Click me!", command=dostuff)
bt.grid()
root.mainloop() |
Looks like the workaround is to provide explicit |
Thanks for the report and script. I can't reproduce this with 3.7.1rc1 tag and also tried this on v3.7.0 which works fine on Mac OS running 10.10.4 and tcl version 8.5 . I checked out the 3.7.1rc1 tag and did a clean rebuild with Steps I followed :
Since the report says it's a regression between 3.7.0 and 3.7.1RC1 I am adding Ned as a friendly ping about this issue so that this can be tracked better between RC releases. |
I got the segfault with Tk 8.6, provided with python.org installer. |
Thanks, I can confirm that this works with 3.7.0 and segfaults with 3.7.1RC1 Mac OS installer that uses Tk 8.6 . Clicking the button and closing the file open dialog triggers this segfault as noted in your description. I don't know how I can configure my local build to use Tk 8.6 and maybe it's a problem with Tk 8.6. It seems from 3.7 and above the installer uses 8.6 while 3.6 dynamically links to the apple's version 8.5 as noted in https://www.python.org/download/mac/tcltk/#built-in-8-6-8 |
Can it be caused by adf4932 ? |
It very likely could be. Thanks for the report. I'll take a look at it a bit later. |
It appears that the segfault behavior *was* introduced by some change in the Tk 8.6 development snapshot I chose to use for the python.org macOS installer builds in 3.7.1rc1 and 3.6.7rc2. For 3.7.1rc2 and 3.6.7rc2, I reverted back to using the standard Tk 8.6.8 release and the segfault seems to have gone away on the systems where I was able to reproduce it with rc1 - whether it segfaulted seems to be system dependent. We'll probably wait for the official release of Tk 8.6.9 before trying to upgrade Tk again. Let us know if the problem reappears. |
Thanks for the release Ned. I can confirm that there is no segfault with Python 3.7.1rc2 (v3.7.1rc2:6c06ef7dc3). |
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: