]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Fix compiler warning for misleading guarding in the tkinter (GH-26244) (GH-26252)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 19 May 2021 18:27:19 +0000 (11:27 -0700)
committerGitHub <noreply@github.com>
Wed, 19 May 2021 18:27:19 +0000 (19:27 +0100)
commit021169f7685bcc733f8c23985c5140d483021f60
tree8f48c41e1ff7d78b30da6ed746d79dad825bcbea
parentd4a9264ab899b4f3088b5afad8956123924a5ab1
Fix compiler warning for misleading guarding in the tkinter (GH-26244) (GH-26252)

The newest gcc emmits this warning:

```
/Modules/_tkinter.c:272:9: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |         ^~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON
      |     ^~~~~~~~~~~~
/Modules/_tkinter.c:243:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  243 |     (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
      |     ^
/Modules/_tkinter.c:272:57: note: in expansion of macro ‘tcl_tstate’
  272 |         if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
      |                                                         ^~~~~~~~~~
/Modules/_tkinter.c:2869:5: note: in expansion of macro ‘LEAVE_PYTHON’
 2869 |     LEAVE_PYTHON

```

that's because the macro packs together two statements at the same level
as the "if". The warning is misleading but is very noisy so it makes
sense to fix it.
(cherry picked from commit 95d04710c5fb0df5393b5add2c5c2de2412673eb)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Modules/_tkinter.c