summaryrefslogtreecommitdiff
path: root/Include/cpython/code.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-06-20 16:04:52 +0200
committerGitHub <noreply@github.com>2022-06-20 16:04:52 +0200
commit7ad6f74fcf9db1ccfeaf0986064870d8d3887300 (patch)
tree2b140e0e4fdb3b58379887bab6ff68ade5c67c60 /Include/cpython/code.h
parent61f24e7885bed096b5d7f75aff13c1001994b35a (diff)
downloadcpython-git-7ad6f74fcf9db1ccfeaf0986064870d8d3887300.tar.gz
gh-87347: Add parenthesis around macro arguments (#93915)
Add unit test on Py_MEMBER_SIZE() and some other macros.
Diffstat (limited to 'Include/cpython/code.h')
-rw-r--r--Include/cpython/code.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Include/cpython/code.h b/Include/cpython/code.h
index 238bf9450a..ebc0df9323 100644
--- a/Include/cpython/code.h
+++ b/Include/cpython/code.h
@@ -29,7 +29,8 @@ typedef uint16_t _Py_CODEUNIT;
#endif
// Use "unsigned char" instead of "uint8_t" here to avoid illegal aliasing:
-#define _Py_SET_OPCODE(word, opcode) (((unsigned char *)&(word))[0] = (opcode))
+#define _Py_SET_OPCODE(word, opcode) \
+ do { ((unsigned char *)&(word))[0] = (opcode); } while (0)
// To avoid repeating ourselves in deepfreeze.py, all PyCodeObject members are
// defined in this macro: