diff options
author | Guido van Rossum <guido@python.org> | 1998-06-15 14:03:52 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-15 14:03:52 (GMT) |
commit | 5e97783c8fe6389ad588f6bc4410dc5e0c56a56f (patch) | |
tree | 389844c171ce68808745ed42095ec687cd472376 /Modules | |
parent | e3bd82117f3b4037f49d20fb4eb0c85eb7185fed (diff) | |
download | cpython-5e97783c8fe6389ad588f6bc4410dc5e0c56a56f.zip cpython-5e97783c8fe6389ad588f6bc4410dc5e0c56a56f.tar.gz cpython-5e97783c8fe6389ad588f6bc4410dc5e0c56a56f.tar.bz2 |
# Note: a previous checkin message was lost because I can now use CVS
# from my PC at home, but it can't send email :-(
Add a clarifying comment about the new ENTER_OVERLAP and
LEAVE_OVERLAP_TCL macros; get rid of all the bogus tests for deleted
interpreters (Tcl already tests for this; they were left over from an
earlier misguided attempt to fix the threading).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_tkinter.c | 43 |
1 files changed, 7 insertions, 36 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index c6c47db..6d096a0 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -146,6 +146,13 @@ PERFORMANCE OF THIS SOFTWARE. interpreter lock; inside the brackets, the Python interpreter lock has been released and the lock for Tcl has been acquired. + Sometimes, it is necessary to have both the Python lock and the Tcl lock. + (For example, when transferring data from the Tcl interpreter result to a + Python string object.) This can be done by using different macros to close + the ENTER_TCL block: ENTER_OVERLAP reacquires the Python lock (and restores + the thread state) but doesn't release the Tcl lock; LEAVE_OVERLAP_TCL + releases the Tcl lock. + By contrast, ENTER_PYTHON(tstate) and LEAVE_PYTHON are used in Tcl event handlers when the handler needs to use Python. Such event handlers are entered while the lock for Tcl is held; the event handler presumably needs @@ -534,12 +541,6 @@ Tkapp_Call(self, args) Tcl_CmdInfo info; /* and this is added */ Tcl_Interp *interp = Tkapp_Interp(self); /* and this too */ - /* and this test */ - if (Tcl_InterpDeleted(interp)) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - if (!(tmp = PyList_New(0))) return NULL; @@ -652,11 +653,6 @@ Tkapp_GlobalCall(self, args) char *cmd; PyObject *res = NULL; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - cmd = Merge(args); if (!cmd) PyErr_SetString(Tkinter_TclError, "merge failed"); @@ -691,11 +687,6 @@ Tkapp_Eval(self, args) if (!PyArg_ParseTuple(args, "s", &script)) return NULL; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - ENTER_TCL err = Tcl_Eval(Tkapp_Interp(self), script); ENTER_OVERLAP @@ -716,11 +707,6 @@ Tkapp_GlobalEval(self, args) PyObject *res = NULL; int err; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - if (!PyArg_ParseTuple(args, "s", &script)) return NULL; @@ -744,11 +730,6 @@ Tkapp_EvalFile(self, args) PyObject *res = NULL; int err; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - if (!PyArg_ParseTuple(args, "s", &fileName)) return NULL; @@ -773,11 +754,6 @@ Tkapp_Record(self, args) PyObject *res = NULL; int err; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - if (!PyArg_ParseTuple(args, "s", &script)) return NULL; @@ -823,11 +799,6 @@ SetVar(self, args, flags) PyObject *newValue; PyObject *tmp; - if (Tcl_InterpDeleted(Tkapp_Interp(self))) { - PyErr_SetString(Tkinter_TclError, "application is destroyed"); - return NULL; - } - tmp = PyList_New(0); if (!tmp) return NULL; |