diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2003-03-03 21:16:39 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2003-03-03 21:16:39 (GMT) |
commit | 12e221750190903675256ed4ef99aab842b40774 (patch) | |
tree | 5185d087f5b91394a16b49039ea32cd98fba8fc8 /Modules/_tkinter.c | |
parent | a52b85262ae7c0ce3ba92ee7e933f5a449690b8c (diff) | |
download | cpython-12e221750190903675256ed4ef99aab842b40774.zip cpython-12e221750190903675256ed4ef99aab842b40774.tar.gz cpython-12e221750190903675256ed4ef99aab842b40774.tar.bz2 |
Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandler
in addition to createfilehandler and creaetetimerhandler.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r-- | Modules/_tkinter.c | 14 |
1 files changed, 13 insertions, 1 deletions
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; |