Skip to content

Commit 43ff868

Browse files
committed
Temporarily get rid of the registration of Tcl_Finalize() as a
low-level Python exit handler. This can attempt to call Python code at a point that the interpreter and thread state have already been destroyed, causing a Bus Error. Given the intended use of Py_AtExit(), I'm not convinced that it's a good idea to call it earlier during Python's finalization sequence... (Although this is the only use for it in the entire distribution.)
1 parent 69a79bc commit 43ff868

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Modules/_tkinter.c

+5
Original file line numberDiff line numberDiff line change
@@ -2030,9 +2030,14 @@ init_tkinter()
20302030
if (PyErr_Occurred())
20312031
return;
20322032

2033+
#if 0
2034+
/* This was not a good idea; through <Destroy> bindings,
2035+
Tcl_Finalize() may invoke Python code but at that point the
2036+
interpreter and thread state have already been destroyed! */
20332037
#if TKMAJORMINOR >= 8000
20342038
Py_AtExit(Tcl_Finalize);
20352039
#endif
2040+
#endif
20362041

20372042
#ifdef macintosh
20382043
/*

0 commit comments

Comments
 (0)