@@ -215,25 +215,25 @@ static PyThreadState *tcl_tstate = NULL;
215215
216216
217217#define ACQUIRE_TCL_LOCK \
218- if (tcl_lock) {\
218+ if (tcl_lock) { \
219219 if (tcl_lock_thread_ident == PyThread_get_thread_ident()) { \
220220 tcl_lock_reentry_count++; \
221221 if(!tcl_lock_reentry_count) \
222222 Py_FatalError("Tcl lock reentry count overflow"); \
223223 } else { \
224224 PyThread_acquire_lock(tcl_lock, 1); \
225225 tcl_lock_thread_ident = PyThread_get_thread_ident(); \
226- }\
226+ } \
227227}
228228
229229#define RELEASE_TCL_LOCK \
230- if (tcl_lock){ \
230+ if (tcl_lock) { \
231231 if (tcl_lock_reentry_count) { \
232232 tcl_lock_reentry_count--; \
233233 } else { \
234234 tcl_lock_thread_ident = 0; \
235235 PyThread_release_lock(tcl_lock); \
236- }\
236+ } \
237237}
238238
239239
@@ -242,18 +242,19 @@ if (tcl_lock){\
242242 ENTER_TCL_CUSTOM_TSTATE(tstate)
243243
244244#define ENTER_TCL_CUSTOM_TSTATE (tstate ) \
245- Py_BEGIN_ALLOW_THREADS \
246- ACQUIRE_TCL_LOCK; tcl_tstate = tstate;
245+ Py_BEGIN_ALLOW_THREADS \
246+ ACQUIRE_TCL_LOCK \
247+ tcl_tstate = tstate;
247248
248249#define LEAVE_TCL \
249250 tcl_tstate = NULL; \
250251 RELEASE_TCL_LOCK; Py_END_ALLOW_THREADS}
251252
252253#define LEAVE_TCL_WITH_BUSYWAIT (result ) \
253254 tcl_tstate = NULL; \
254- RELEASE_TCL_LOCK; \
255- if (result == 0)\
256- Sleep(Tkinter_busywaitinterval);\
255+ RELEASE_TCL_LOCK \
256+ if (result == 0) \
257+ Sleep(Tkinter_busywaitinterval); \
257258 Py_END_ALLOW_THREADS
258259
259260
@@ -264,7 +265,7 @@ if (tcl_lock){\
264265 Py_BEGIN_ALLOW_THREADS
265266
266267#define LEAVE_OVERLAP_TCL \
267- tcl_tstate = NULL; RELEASE_TCL_LOCK; }
268+ tcl_tstate = NULL; RELEASE_TCL_LOCK }
268269
269270#define ENTER_PYTHON \
270271{ PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; PyEval_RestoreThread((tstate)); }
@@ -2015,7 +2016,7 @@ SetVar(PyObject *self, PyObject *args, int flags)
20152016 if (newval ) {
20162017 LEAVE_OVERLAP
20172018 ok = Tcl_SetVar2Ex (Tkapp_Interp (self ), name1 , NULL ,
2018- newval , flags );
2019+ newval , flags );
20192020 ENTER_OVERLAP
20202021 if (!ok )
20212022 Tkinter_Error (self );
@@ -2038,7 +2039,7 @@ SetVar(PyObject *self, PyObject *args, int flags)
20382039 if (newval ) {
20392040 LEAVE_OVERLAP
20402041 ok = Tcl_SetVar2Ex (Tkapp_Interp (self ), name1 , name2 ,
2041- newval , flags );
2042+ newval , flags );
20422043 ENTER_OVERLAP
20432044 if (!ok )
20442045 Tkinter_Error (self );
@@ -2517,8 +2518,8 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
25172518 ENTER_PYTHON
25182519
25192520 /* TBD: no error checking here since we know, via the
2520- * Tkapp_CreateCommand() that the client data is a two-tuple
2521- */
2521+ * Tkapp_CreateCommand() that the client data is a two-tuple
2522+ */
25222523 func = data -> func ;
25232524
25242525 /* Create argument list (argv1, ..., argvN) */
@@ -2539,14 +2540,14 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
25392540 return PythonCmd_Error ();
25402541
25412542 obj_res = AsObj (res );
2542- if (obj_res ) {
2543- Tcl_SetObjResult (interp , obj_res );
2544- rv = TCL_OK ;
2545- }
25462543 if (obj_res == NULL ) {
25472544 Py_DECREF (res );
25482545 return PythonCmd_Error ();
25492546 }
2547+ else {
2548+ Tcl_SetObjResult (interp , obj_res );
2549+ rv = TCL_OK ;
2550+ }
25502551
25512552 Py_DECREF (res );
25522553
0 commit comments