summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-03-03 10:40:01 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-03-03 10:40:01 (GMT)
commit7f13489bdfbad313774aebd8db8e8d127cb9184f (patch)
tree8a69e41699e27b114703f153105a4acb967dbd79 /Modules
parent4eab486476c0082087a8460a5ab1064e64cc1a6b (diff)
downloadcpython-7f13489bdfbad313774aebd8db8e8d127cb9184f.zip
cpython-7f13489bdfbad313774aebd8db8e8d127cb9184f.tar.gz
cpython-7f13489bdfbad313774aebd8db8e8d127cb9184f.tar.bz2
Don't crash on _tkinter.createfilehandler in non-threaded Tcl;
disable this function in threaded Tcl. Likewise for creaetetimerhandler. Fixes #692416.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_tkinter.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 4e6bcbc..813d27c 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2202,7 +2202,19 @@ Tkapp_CreateFileHandler(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
&file, &mask, &func))
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.createfilehandler not supported "
+ "for threaded Tcl");
+ return NULL;
+ }
+
+ if (self) {
+ CHECK_TCL_APPARTMENT;
+ }
+
tfile = PyObject_AsFileDescriptor(file);
if (tfile < 0)
return NULL;
@@ -2396,6 +2408,19 @@ Tkapp_CreateTimerHandler(PyObject *self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "bad argument list");
return NULL;
}
+
+ if (!self && !tcl_lock) {
+ /* We don't have the Tcl lock since Tcl is threaded. */
+ PyErr_SetString(PyExc_RuntimeError,
+ "_tkinter.createtimerhandler not supported "
+ "for threaded Tcl");
+ return NULL;
+ }
+
+ if (self) {
+ CHECK_TCL_APPARTMENT;
+ }
+
v = Tktt_New(func);
v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler,
(ClientData)v);