]> granicus.if.org Git - python/commitdiff
Issue #9518: Extend the PyModuleDef_HEAD_INIT macro to explicitly
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 17 Nov 2010 21:20:18 +0000 (21:20 +0000)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 17 Nov 2010 21:20:18 +0000 (21:20 +0000)
zero-initialize all fields, fixing compiler warnings seen when building
extension modules with gcc with "-Wmissing-field-initializers" (implied
by "-W")

Include/moduleobject.h
Misc/NEWS

index 376a525d1c389d9b667d71183aa8f9595b62380b..34fa8109326d83397890714ebe03268b62755fa8 100644 (file)
@@ -28,7 +28,12 @@ typedef struct PyModuleDef_Base {
   PyObject* m_copy;
 } PyModuleDef_Base;
 
-#define PyModuleDef_HEAD_INIT {PyObject_HEAD_INIT(NULL)}
+#define PyModuleDef_HEAD_INIT { \
+    PyObject_HEAD_INIT(NULL)    \
+    NULL, /* m_init */          \
+    0,    /* m_index */         \
+    NULL, /* m_copy */          \
+  }
 
 typedef struct PyModuleDef{
   PyModuleDef_Base m_base;
index 431218606732104d2a481f05762adaba6616e6f1..9f47ca339cba8ca9c1a7dbe9d793d07517063e88 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,11 @@ What's New in Python 3.2 Beta 1?
 Core and Builtins
 -----------------
 
+- Issue #9518: Extend the PyModuleDef_HEAD_INIT macro to explicitly
+  zero-initialize all fields, fixing compiler warnings seen when building
+  extension modules with gcc with "-Wmissing-field-initializers" (implied
+  by "-W")
+
 Library
 -------