diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-30 14:51:56 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-30 14:51:56 (GMT) |
commit | 5879d4122afcbc6e3225edb3d09e79116fdaab7a (patch) | |
tree | 2a1a983d1cb9fbff186b032579518a14a1da92e1 /Modules | |
parent | 5550365f4b14520297e47043f16f0ecff9081101 (diff) | |
download | cpython-5879d4122afcbc6e3225edb3d09e79116fdaab7a.zip cpython-5879d4122afcbc6e3225edb3d09e79116fdaab7a.tar.gz cpython-5879d4122afcbc6e3225edb3d09e79116fdaab7a.tar.bz2 |
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line
this is better written using assertRaises
........
r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line
this can be slightly less ugly
........
r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines
Adjusted _tkinter to compile without warnings when WITH_THREAD is not
defined (part of issue #5035)
........
r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line
Fix typo.
........
r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line
give os.symlink and os.link() better parameter names #5564
........
r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line
Switch to fixed Sphinx version.
........
r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines
Add section numbering to some of the larger subdocuments.
........
r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line
Typo fix.
........
r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line
Make life easier for non-CPython implementations.
........
r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line
this has been fixed since 2.6 (I love removing these)
........
r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line
thanks to guido's bytecode verifier, this is fixed
........
r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line
use the awesome new status iterator
........
r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line
there's actually three methods here #5600
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_tkinter.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 9e7f374..4d81058 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -732,6 +732,7 @@ Tkapp_New(char *screenName, char *className, } +#ifdef WITH_THREAD static void Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev, Tcl_Condition *cond, Tcl_Mutex *mutex) @@ -744,6 +745,7 @@ Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev, Tcl_MutexUnlock(mutex); Py_END_ALLOW_THREADS } +#endif /** Tcl Eval **/ @@ -1110,8 +1112,8 @@ FromObj(PyObject* tkapp, Tcl_Obj *value) return newPyTclObject(value); } +#ifdef WITH_THREAD /* This mutex synchronizes inter-thread command calls. */ - TCL_DECLARE_MUTEX(call_mutex) typedef struct Tkapp_CallEvent { @@ -1123,6 +1125,7 @@ typedef struct Tkapp_CallEvent { PyObject **exc_type, **exc_value, **exc_tb; Tcl_Condition *done; } Tkapp_CallEvent; +#endif void Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc) @@ -1210,6 +1213,8 @@ Tkapp_CallResult(TkappObject *self) return res; } +#ifdef WITH_THREAD + /* Tkapp_CallProc is the event procedure that is executed in the context of the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't hold the Python lock. */ @@ -1254,6 +1259,8 @@ done: return 1; } +#endif + /* This is the main entry point for calling a Tcl command. It supports three cases, with regard to threading: 1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in @@ -1483,9 +1490,11 @@ Tkapp_AddErrorInfo(PyObject *self, PyObject *args) /** Tcl Variable **/ +typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags); + +#ifdef WITH_THREAD TCL_DECLARE_MUTEX(var_mutex) -typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags); typedef struct VarEvent { Tcl_Event ev; /* must be first */ PyObject *self; @@ -1497,6 +1506,7 @@ typedef struct VarEvent { PyObject **exc_val; Tcl_Condition *cond; } VarEvent; +#endif static int varname_converter(PyObject *in, void *_out) @@ -1518,6 +1528,8 @@ varname_converter(PyObject *in, void *_out) return 0; } +#ifdef WITH_THREAD + static void var_perform(VarEvent *ev) { @@ -1545,11 +1557,13 @@ var_proc(VarEvent* ev, int flags) return 1; } +#endif + static PyObject* var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags) { - TkappObject *self = (TkappObject*)selfptr; #ifdef WITH_THREAD + TkappObject *self = (TkappObject*)selfptr; if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { TkappObject *self = (TkappObject*)selfptr; VarEvent *ev; @@ -2052,6 +2066,7 @@ PythonCmdDelete(ClientData clientData) +#ifdef WITH_THREAD TCL_DECLARE_MUTEX(command_mutex) typedef struct CommandEvent{ @@ -2078,6 +2093,7 @@ Tkapp_CommandProc(CommandEvent *ev, int flags) Tcl_MutexUnlock(&command_mutex); return 1; } +#endif static PyObject * Tkapp_CreateCommand(PyObject *selfptr, PyObject *args) @@ -2108,7 +2124,7 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args) Py_INCREF(func); data->self = selfptr; data->func = func; - +#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { Tcl_Condition cond = NULL; CommandEvent *ev = (CommandEvent*)ckalloc(sizeof(CommandEvent)); @@ -2122,7 +2138,9 @@ Tkapp_CreateCommand(PyObject *selfptr, PyObject *args) Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &command_mutex); Tcl_ConditionFinalize(&cond); } - else { + else +#endif + { ENTER_TCL err = Tcl_CreateCommand( Tkapp_Interp(self), cmdName, PythonCmd, @@ -2150,6 +2168,8 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args) if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName)) return NULL; + +#ifdef WITH_THREAD if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) { Tcl_Condition cond = NULL; CommandEvent *ev; @@ -2164,7 +2184,9 @@ Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args) &command_mutex); Tcl_ConditionFinalize(&cond); } - else { + else +#endif + { ENTER_TCL err = Tcl_DeleteCommand(self->interp, cmdName); LEAVE_TCL |