fix C compiler warnings about missing PyModuleDef field initialisers in Py3.[01]
authorStefan Behnel <stefan_ml@behnel.de>
Sun, 27 Jan 2013 05:16:30 +0000 (06:16 +0100)
committerStefan Behnel <stefan_ml@behnel.de>
Sun, 27 Jan 2013 05:16:30 +0000 (06:16 +0100)
Cython/Compiler/ModuleNode.py

index 3b0743b..913e954 100644 (file)
@@ -2077,7 +2077,12 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         code.putln("")
         code.putln("#if PY_MAJOR_VERSION >= 3")
         code.putln("static struct PyModuleDef %s = {" % Naming.pymoduledef_cname)
+        code.putln("#if PY_VERSION_HEX < 0x03020000")
+        # fix C compiler warnings due to missing initialisers
+        code.putln("  { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },")
+        code.putln("#else")
         code.putln("  PyModuleDef_HEAD_INIT,")
+        code.putln("#endif")
         code.putln('  __Pyx_NAMESTR("%s"),' % env.module_name)
         code.putln("  %s, /* m_doc */" % doc)
         code.putln("  -1, /* m_size */")