summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ModuleNode.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2018-08-10 18:07:54 +0200
committerStefan Behnel <stefan_ml@behnel.de>2018-08-10 18:07:54 +0200
commit3cb95b766ddd3f8812d7dc582181ac87014a7d04 (patch)
tree2d2dc182770ee9ca5016d2b12e8d8f54eac9021b /Cython/Compiler/ModuleNode.py
parent429936a2d90648b64084c80deb7bda96b434b61d (diff)
downloadcython-3cb95b766ddd3f8812d7dc582181ac87014a7d04.tar.gz
Mark error raising code in PEP 489 init phase as TODO.
Diffstat (limited to 'Cython/Compiler/ModuleNode.py')
-rw-r--r--Cython/Compiler/ModuleNode.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index 6f4ff6b3b..c69f48a03 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -2325,20 +2325,20 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.put_declare_refcount_context()
code.putln("#if CYTHON_PEP489_MULTI_PHASE_INIT")
+ # Most extension modules simply can't deal with it, and Cython isn't ready either.
+ # See issues listed here: https://docs.python.org/3/c-api/init.html#sub-interpreter-support
+ code.putln("if (%s) {" % Naming.module_cname)
# Hack: enforce single initialisation.
- code.putln("if (%s && %s == %s) return 0;" % (
- Naming.module_cname,
+ code.putln("if (%s == %s) return 0;" % (
Naming.module_cname,
Naming.pymodinit_module_arg,
))
- # # Most extension modules simply can't deal with it, and Cython isn't ready either.
- # # See issues listed here: https://docs.python.org/3/c-api/init.html#sub-interpreter-support
- # code.putln("if (%s) {" % Naming.module_cname)
+ # TODO: We should raise an exception here, as long as Cython cannot actually support reinitialisation.
# code.putln('PyErr_SetString(PyExc_RuntimeError,'
# ' "Module \'%s\' has already been imported. Re-initialisation is not supported");' %
# env.module_name)
# code.putln("return -1;")
- # code.putln("}")
+ code.putln("}")
code.putln("#elif PY_MAJOR_VERSION >= 3")
# Hack: enforce single initialisation also on reimports under different names on Python 3 (with PEP 3121/489).
code.putln("if (%s) return __Pyx_NewRef(%s);" % (