summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-01-04 08:36:57 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-01-04 08:36:57 (GMT)
commit6a759d9e00fdb0f0ac2eeb206849e0a2e138af87 (patch)
tree76256fe47ac2f497774077bf3069264b379ef5df /Modules/_tkinter.c
parentadf642038ee02b02165c3852a72217c1b65d8715 (diff)
downloadcpython-6a759d9e00fdb0f0ac2eeb206849e0a2e138af87.zip
cpython-6a759d9e00fdb0f0ac2eeb206849e0a2e138af87.tar.gz
cpython-6a759d9e00fdb0f0ac2eeb206849e0a2e138af87.tar.bz2
Remove appartment check from dooneevent. Fixes #660961.
Check whether self is NULL in mainloop.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index c759a3a..6ca6f17 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2416,10 +2416,20 @@ Tkapp_MainLoop(PyObject *_self, PyObject *args)
if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
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.mainloop not supported "
+ "for threaded Tcl");
+ return NULL;
+ }
+
+ if (self) {
+ CHECK_TCL_APPARTMENT;
+ self->dispatching = 1;
+ }
quitMainLoop = 0;
- self->dispatching = 1;
while (Tk_GetNumMainWindows() > threshold &&
!quitMainLoop &&
!errorInCmd)
@@ -2427,7 +2437,7 @@ Tkapp_MainLoop(PyObject *_self, PyObject *args)
int result;
#ifdef WITH_THREAD
- if (self->threaded) {
+ if (self && self->threaded) {
/* Allow other Python threads to run. */
ENTER_TCL
result = Tcl_DoOneEvent(0);
@@ -2449,13 +2459,15 @@ Tkapp_MainLoop(PyObject *_self, PyObject *args)
#endif
if (PyErr_CheckSignals() != 0) {
- self->dispatching = 0;
+ if (self)
+ self->dispatching = 0;
return NULL;
}
if (result < 0)
break;
}
- self->dispatching = 0;
+ if (self)
+ self->dispatching = 0;
quitMainLoop = 0;
if (errorInCmd) {
@@ -2476,7 +2488,6 @@ Tkapp_DoOneEvent(PyObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags))
return NULL;
- CHECK_TCL_APPARTMENT;
ENTER_TCL
rv = Tcl_DoOneEvent(flags);