Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
8ebe2727
Commit
8ebe2727
authored
Aug 10, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Actually enable the error on PEP-489 module reinitialisation, and add it to the changelog.
parent
6b6cca3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
7 deletions
+14
-7
CHANGES.rst
CHANGES.rst
+4
-0
Cython/Build/IpythonMagic.py
Cython/Build/IpythonMagic.py
+6
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+4
-5
No files found.
CHANGES.rst
View file @
8ebe2727
...
...
@@ -57,6 +57,10 @@ Bugs fixed
exception
stack
traces
.
Patch
by
Jeroen
Demeyer
.
(
Github
issue
#
2492
)
*
When
PEP
-
489
support
is
enabled
,
reloading
the
module
overwrote
any
static
module
state
.
It
now
raises
an
exception
instead
,
given
that
reloading
is
not
actually
supported
.
Other
changes
-------------
...
...
Cython/Build/IpythonMagic.py
View file @
8ebe2727
...
...
@@ -166,11 +166,15 @@ class CythonMagics(Magics):
f
.
write
(
cell
)
if
'pyximport'
not
in
sys
.
modules
or
not
self
.
_pyximport_installed
:
import
pyximport
pyximport
.
install
(
reload_support
=
True
)
pyximport
.
install
()
self
.
_pyximport_installed
=
True
if
module_name
in
self
.
_reloads
:
module
=
self
.
_reloads
[
module_name
]
reload
(
module
)
# Note: reloading extension modules is not actually supported
# (requires PEP-489 reinitialisation support).
# Don't know why this should ever have worked as it reads here.
# All we really need to do is to update the globals below.
#reload(module)
else
:
__import__
(
module_name
)
module
=
sys
.
modules
[
module_name
]
...
...
Cython/Compiler/ModuleNode.py
View file @
8ebe2727
...
...
@@ -2333,11 +2333,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
Naming
.
module_cname
,
Naming
.
pymodinit_module_arg
,
))
# 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
(
'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
(
"#elif PY_MAJOR_VERSION >= 3"
)
# Hack: enforce single initialisation also on reimports under different names on Python 3 (with PEP 3121/489).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment