[Python-checkins] gh-91321: Fix PyModuleDef_HEAD_INIT on C++ (#92259)

vstinner webhook-mailer at python.org
Tue May 3 16:40:29 EDT 2022


https://github.com/python/cpython/commit/3a35b62ea003182c643516098cc781944d425800
commit: 3a35b62ea003182c643516098cc781944d425800
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-05-03T22:40:20+02:00
summary:

gh-91321: Fix PyModuleDef_HEAD_INIT on C++ (#92259)

The PyModuleDef_HEAD_INIT macro now uses _Py_NULL to fix C++ compiler
warnings when using it in C++.

files:
M Include/moduleobject.h

diff --git a/Include/moduleobject.h b/Include/moduleobject.h
index 8b62c45505fb6..75abd2cf2b905 100644
--- a/Include/moduleobject.h
+++ b/Include/moduleobject.h
@@ -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



More information about the Python-checkins mailing list