summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2013-01-27 06:16:30 +0100
committerStefan Behnel <stefan_ml@behnel.de>2013-01-27 06:16:30 +0100
commit372afe70291cb1e2aaf2bb40f9ce34c409a34094 (patch)
treecc07549569824c411baff9f09ad218bc1c095734 /Cython/Compiler/ModuleNode.py
parenta49992f1359fb75c9fac5b816c0caf06cdeb4a49 (diff)
downloadcython-372afe70291cb1e2aaf2bb40f9ce34c409a34094.tar.gz
fix C compiler warnings about missing PyModuleDef field initialisers in Py3.[01]
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 3b0743bed..913e95448 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -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 */")