diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2019-01-11 18:37:54 +0100 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2019-01-11 18:44:12 +0100 |
commit | b43bf13574669dbb10e1ac4c992f9fc66132b6f4 (patch) | |
tree | 9cd17455ca7e26f1bfde3ba2f466299c4d1692ba | |
parent | a410908a135c96c414e4c850f091c994fcdb97df (diff) | |
download | cython-b43bf13574669dbb10e1ac4c992f9fc66132b6f4.tar.gz |
Export "PyInit___init__" and "init__init__" as additional module init functions under Windows to make compiled packages work.pkg_init_windows
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 9 |
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.) |