mirror of
https://github.com/python/cpython
synced 2026-09-29 10:30:29 +03:00
Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandler
in addition to createfilehandler and creaetetimerhandler.
This commit is contained in:
parent
a52b85262a
commit
12e2217501
2 changed files with 17 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue