summaryrefslogtreecommitdiffstats
path: root/Include/modsupport.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/modsupport.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/modsupport.h')
-rw-r--r--Include/modsupport.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/Include/modsupport.h b/Include/modsupport.h
index c42a3f1..4e369bd 100644
--- a/Include/modsupport.h
+++ b/Include/modsupport.h
@@ -56,8 +56,8 @@ PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char
PyAPI_FUNC(int) PyModule_AddType(PyObject *module, PyTypeObject *type);
#endif /* Py_LIMITED_API */
-#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
-#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c)
+#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant((m), #c, (c))
+#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant((m), #c, (c))
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
/* New in 3.5 */
@@ -132,10 +132,10 @@ PyAPI_FUNC(PyObject *) PyModule_Create2(PyModuleDef*, int apiver);
#ifdef Py_LIMITED_API
#define PyModule_Create(module) \
- PyModule_Create2(module, PYTHON_ABI_VERSION)
+ PyModule_Create2((module), PYTHON_ABI_VERSION)
#else
#define PyModule_Create(module) \
- PyModule_Create2(module, PYTHON_API_VERSION)
+ PyModule_Create2((module), PYTHON_API_VERSION)
#endif
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
@@ -146,10 +146,10 @@ PyAPI_FUNC(PyObject *) PyModule_FromDefAndSpec2(PyModuleDef *def,
#ifdef Py_LIMITED_API
#define PyModule_FromDefAndSpec(module, spec) \
- PyModule_FromDefAndSpec2(module, spec, PYTHON_ABI_VERSION)
+ PyModule_FromDefAndSpec2((module), (spec), PYTHON_ABI_VERSION)
#else
#define PyModule_FromDefAndSpec(module, spec) \
- PyModule_FromDefAndSpec2(module, spec, PYTHON_API_VERSION)
+ PyModule_FromDefAndSpec2((module), (spec), PYTHON_API_VERSION)
#endif /* Py_LIMITED_API */
#endif /* New in 3.5 */