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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
4208b8b7
Commit
4208b8b7
authored
Nov 04, 2012
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merged 0.17 branch into master
parents
3cb6bcc9
5fb2c885
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+2
-2
tests/run/reimport_from_package.srctree
tests/run/reimport_from_package.srctree
+37
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
4208b8b7
...
@@ -2097,9 +2097,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
...
@@ -2097,9 +2097,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code
.
putln
(
"{"
)
code
.
putln
(
"{"
)
code
.
putln
(
"PyObject *modules = PyImport_GetModuleDict(); %s"
%
code
.
putln
(
"PyObject *modules = PyImport_GetModuleDict(); %s"
%
code
.
error_goto_if_null
(
"modules"
,
self
.
pos
))
code
.
error_goto_if_null
(
"modules"
,
self
.
pos
))
code
.
putln
(
'if (!PyDict_GetItemString(modules, "%s")) {'
%
env
.
module
_name
)
code
.
putln
(
'if (!PyDict_GetItemString(modules, "%s")) {'
%
env
.
qualified
_name
)
code
.
putln
(
code
.
error_goto_if_neg
(
'PyDict_SetItemString(modules, "%s", %s)'
%
(
code
.
putln
(
code
.
error_goto_if_neg
(
'PyDict_SetItemString(modules, "%s", %s)'
%
(
env
.
module
_name
,
env
.
module_cname
),
self
.
pos
))
env
.
qualified
_name
,
env
.
module_cname
),
self
.
pos
))
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
code
.
putln
(
"}"
)
code
.
putln
(
"#endif"
)
code
.
putln
(
"#endif"
)
...
...
tests/run/reimport_from_package.srctree
0 → 100644
View file @
4208b8b7
PYTHON setup.py build_ext --inplace
PYTHON -c "import a"
######## setup.py ########
from Cython.Build.Dependencies import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.cimport_from_pyx = True
from distutils.core import setup
setup(
ext_modules = cythonize("**/*.pyx"),
)
######## a.pyx ########
import sys
import a
assert a in sys.modules.values(), list(sys.modules)
assert sys.modules['a'] is a, list(sys.modules)
from atest.package import module
######## atest/__init__.py ########
######## atest/package/__init__.py ########
######## atest/package/module.pyx ########
import sys
assert 'atest.package.module' in sys.modules
import a
import atest.package.module as module
assert module in sys.modules.values(), list(sys.modules)
assert sys.modules['atest.package.module'] is module, list(sys.modules)
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