summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_code.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-20 14:04:52 (GMT)
committerGitHub <noreply@github.com>2022-06-20 14:04:52 (GMT)
commit7ad6f74fcf9db1ccfeaf0986064870d8d3887300 (patch)
tree2b140e0e4fdb3b58379887bab6ff68ade5c67c60 /Include/internal/pycore_code.h
parent61f24e7885bed096b5d7f75aff13c1001994b35a (diff)
downloadcpython-7ad6f74fcf9db1ccfeaf0986064870d8d3887300.zip
cpython-7ad6f74fcf9db1ccfeaf0986064870d8d3887300.tar.gz
cpython-7ad6f74fcf9db1ccfeaf0986064870d8d3887300.tar.bz2
gh-87347: Add parenthesis around macro arguments (#93915)
Add unit test on Py_MEMBER_SIZE() and some other macros.
Diffstat (limited to 'Include/internal/pycore_code.h')
-rw-r--r--Include/internal/pycore_code.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h
index bb82d9f..7e21c5a 100644
--- a/Include/internal/pycore_code.h
+++ b/Include/internal/pycore_code.h
@@ -252,16 +252,16 @@ extern int _PyStaticCode_InternStrings(PyCodeObject *co);
#ifdef Py_STATS
-#define STAT_INC(opname, name) _py_stats.opcode_stats[opname].specialization.name++
-#define STAT_DEC(opname, name) _py_stats.opcode_stats[opname].specialization.name--
-#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[opname].execution_count++
+#define STAT_INC(opname, name) _py_stats.opcode_stats[(opname)].specialization.name++
+#define STAT_DEC(opname, name) _py_stats.opcode_stats[(opname)].specialization.name--
+#define OPCODE_EXE_INC(opname) _py_stats.opcode_stats[(opname)].execution_count++
#define CALL_STAT_INC(name) _py_stats.call_stats.name++
#define OBJECT_STAT_INC(name) _py_stats.object_stats.name++
#define OBJECT_STAT_INC_COND(name, cond) \
do { if (cond) _py_stats.object_stats.name++; } while (0)
-#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[name]++
+#define EVAL_CALL_STAT_INC(name) _py_stats.call_stats.eval_calls[(name)]++
#define EVAL_CALL_STAT_INC_IF_FUNCTION(name, callable) \
- do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[name]++; } while (0)
+ do { if (PyFunction_Check(callable)) _py_stats.call_stats.eval_calls[(name)]++; } while (0)
// Used by the _opcode extension which is built as a shared library
PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);