]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91321: Fix PyModuleDef_HEAD_INIT on C++ (#92259)
authorVictor Stinner <vstinner@python.org>
Tue, 3 May 2022 20:40:20 +0000 (22:40 +0200)
committerGitHub <noreply@github.com>
Tue, 3 May 2022 20:40:20 +0000 (22:40 +0200)
The PyModuleDef_HEAD_INIT macro now uses _Py_NULL to fix C++ compiler
warnings when using it in C++.

Include/moduleobject.h

index 8b62c45505fb6178e9db38aedf49a9b3e72de508..75abd2cf2b90508433660f97e325460c3de2897f 100644 (file)
@@ -48,11 +48,11 @@ typedef struct PyModuleDef_Base {
   PyObject* m_copy;
 } PyModuleDef_Base;
 
-#define PyModuleDef_HEAD_INIT { \
-    PyObject_HEAD_INIT(NULL)    \
-    NULL, /* m_init */          \
-    0,    /* m_index */         \
-    NULL, /* m_copy */          \
+#define PyModuleDef_HEAD_INIT {  \
+    PyObject_HEAD_INIT(_Py_NULL) \
+    _Py_NULL, /* m_init */       \
+    0,        /* m_index */      \
+    _Py_NULL, /* m_copy */       \
   }
 
 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000