Skip to content

Fix compiler warning for misleading guarding in the tkinter #26244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Modules/_tkinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,15 @@ static PyThreadState *tcl_tstate = NULL;
#endif

#define ENTER_TCL \
{ PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
{ PyThreadState *tstate = PyThreadState_Get(); \
Py_BEGIN_ALLOW_THREADS \
if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \
tcl_tstate = tstate;

#define LEAVE_TCL \
tcl_tstate = NULL; \
if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
if(tcl_lock)PyThread_release_lock(tcl_lock); \
Py_END_ALLOW_THREADS}

#define ENTER_OVERLAP \
Py_END_ALLOW_THREADS
Expand All @@ -261,12 +264,14 @@ static PyThreadState *tcl_tstate = NULL;

#define ENTER_PYTHON \
{ PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
if(tcl_lock) \
PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
if(tcl_lock) \
PyThread_release_lock(tcl_lock); \
PyEval_RestoreThread((tstate)); }

#define LEAVE_PYTHON \
{ PyThreadState *tstate = PyEval_SaveThread(); \
if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); \
tcl_tstate = tstate; }

#define CHECK_TCL_APPARTMENT \
if (((TkappObject *)self)->threaded && \
Expand Down