summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2019-01-12 08:38:34 +0100
committerStefan Behnel <stefan_ml@behnel.de>2019-01-12 08:38:34 +0100
commit12148662370af997a963990efdaeddd85031b35b (patch)
tree8b9c9d5d47ae060228cf4da47d74a578d3ae00cb
parent1c6ab8b7fe1f80e1ffc2c105b8202f1eba230f53 (diff)
parentb43bf13574669dbb10e1ac4c992f9fc66132b6f4 (diff)
downloadcython-12148662370af997a963990efdaeddd85031b35b.tar.gz
Merge branch 'pkg_init_windows'
-rw-r--r--Cython/Compiler/ModuleNode.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index c256ef883..0af1e3cc0 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -2297,9 +2297,18 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("#if PY_MAJOR_VERSION < 3")
# Optimise for small code size as the module init function is only executed once.
code.putln("%s CYTHON_SMALL_CODE; /*proto*/" % header2)
+ if self.scope.is_package:
+ code.putln("#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(WIN32) || defined(MS_WINDOWS))")
+ code.putln("__Pyx_PyMODINIT_FUNC init__init__(void) { init%s(); };" % env.module_name)
+ code.putln("#endif")
code.putln(header2)
code.putln("#else")
code.putln("%s CYTHON_SMALL_CODE; /*proto*/" % header3)
+ if self.scope.is_package:
+ code.putln("#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(WIN32) || defined(MS_WINDOWS))")
+ code.putln("__Pyx_PyMODINIT_FUNC PyInit___init__(void) { return %s(); };" % (
+ self.mod_init_func_cname('PyInit', env)))
+ code.putln("#endif")
code.putln(header3)
# CPython 3.5+ supports multi-phase module initialisation (gives access to __spec__, __file__, etc.)