summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/_tkinter.c14
2 files changed, 17 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 5bf335a..fa1b8f9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -24,6 +24,10 @@ Core and builtins
Extension modules
-----------------
+- Using createfilehandler, deletefilehandler, createtimerhandler functions
+ on Tkinter.tkinter (_tkinter module) no longer crashes the interpreter.
+ See SF bug #692416.
+
- Modified the fcntl.ioctl() function to allow modification of a passed
mutable buffer (for details see the reference documentation).
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 813d27c..100e06f 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2243,7 +2243,19 @@ Tkapp_DeleteFileHandler(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
return NULL;
- CHECK_TCL_APPARTMENT;
+
+ if (!self && !tcl_lock) {
+ /* We don't have the Tcl lock since Tcl is threaded. */
+ PyErr_SetString(PyExc_RuntimeError,
+ "_tkinter.deletefilehandler not supported "
+ "for threaded Tcl");
+ return NULL;
+ }
+
+ if (self) {
+ CHECK_TCL_APPARTMENT;
+ }
+
tfile = PyObject_AsFileDescriptor(file);
if (tfile < 0)
return NULL;