File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -289,16 +289,6 @@ static PyThreadState *tcl_tstate = NULL;
289289 if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \
290290 tcl_tstate = tstate; }
291291
292- #define CHECK_TCL_APPARTMENT (op ) \
293- do { \
294- TkappObject *app = TkappObject_CAST(op); \
295- if (app->threaded && app->thread_id != Tcl_GetCurrentThread()) { \
296- PyErr_SetString(PyExc_RuntimeError, \
297- "Calling Tcl from different apartment"); \
298- return 0; \
299- } \
300- } while (0)
301-
302292#ifndef FREECAST
303293#define FREECAST (char *)
304294#endif
@@ -333,6 +323,24 @@ typedef struct {
333323#define TkappObject_CAST (op ) ((TkappObject *)(op))
334324#define Tkapp_Interp (v ) (TkappObject_CAST(v)->interp)
335325
326+ static inline int
327+ check_tcl_appartment (TkappObject * app )
328+ {
329+ if (app -> threaded && app -> thread_id != Tcl_GetCurrentThread ()) {
330+ PyErr_SetString (PyExc_RuntimeError ,
331+ "Calling Tcl from different apartment" );
332+ return -1 ;
333+ }
334+ return 0 ;
335+ }
336+
337+ #define CHECK_TCL_APPARTMENT (APP ) \
338+ do { \
339+ if (check_tcl_appartment(APP) < 0) { \
340+ return 0; \
341+ } \
342+ } while (0)
343+
336344
337345/**** Error Handling ****/
338346
You can’t perform that action at this time.
0 commit comments