Skip to content

Commit d8e37a7

Browse files
committed
gh-162214: Test Py_STATS macro using #ifdef
Replace "#if Py_STATS" with "#ifdef Py_STATS". All other C files already check for "#ifdef Py_STATS". Example of fixed compiler warning when building Python with -Wundef: Python/specialize.c:33:5: warning: 'Py_STATS' is not defined, evaluates to '0' [-Wundef] 33 | #if Py_STATS | ^~~~~~~~
1 parent 355486e commit d8e37a7

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎Python/pystate.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ tstate_deactivate(PyThreadState *tstate)
22942294
assert(tstate_is_bound(tstate));
22952295
assert(tstate->_status.active);
22962296

2297-
#if Py_STATS
2297+
#ifdef Py_STATS
22982298
_PyStats_Detach((_PyThreadStateImpl *)tstate);
22992299
#endif
23002300

‎Python/specialize.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* InternalDocs/interpreter.md `Specialization` section.
3131
*/
3232

33-
#if Py_STATS
33+
#ifdef Py_STATS
3434
#define SPECIALIZATION_FAIL(opcode, kind) \
3535
do { \
3636
PyStats *s = _PyStats_GET(); \
@@ -42,7 +42,7 @@ do { \
4242
} while (0)
4343
#else
4444
# define SPECIALIZATION_FAIL(opcode, kind) ((void)0)
45-
#endif // Py_STATS
45+
#endif // !Py_STATS
4646

4747
static void
4848
fixup_getiter(_Py_CODEUNIT *instruction, int flags)

0 commit comments

Comments
 (0)