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
bac20ea8
Commit
bac20ea8
authored
Aug 24, 2020
by
da-woods
Committed by
GitHub
Aug 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid merged-in code picking up directives from main module (GH-3785)
Fixes
https://github.com/cython/cython/issues/1071
parent
e3586ce2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
Cython/Compiler/ModuleNode.py
Cython/Compiler/ModuleNode.py
+4
-0
tests/run/inlinepxd.pyx
tests/run/inlinepxd.pyx
+14
-0
tests/run/inlinepxd_support.pxd
tests/run/inlinepxd_support.pxd
+6
-0
No files found.
Cython/Compiler/ModuleNode.py
View file @
bac20ea8
...
...
@@ -97,6 +97,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# CodeGenerator, and tell that CodeGenerator to generate code
# from multiple sources.
assert
isinstance
(
self
.
body
,
Nodes
.
StatListNode
)
if
scope
.
directives
!=
self
.
scope
.
directives
:
# merged in nodes should keep their original compiler directives
# (for example inline cdef functions)
tree
=
Nodes
.
CompilerDirectivesNode
(
tree
.
pos
,
body
=
tree
,
directives
=
scope
.
directives
)
if
isinstance
(
tree
,
Nodes
.
StatListNode
):
self
.
body
.
stats
.
extend
(
tree
.
stats
)
else
:
...
...
tests/run/inlinepxd.pyx
View file @
bac20ea8
# mode: run
# tag: inline, pxd
# cython: wraparound = False
__doc__
=
u"""
>>> f()
3
...
...
@@ -28,3 +33,12 @@ def i():
def
j
():
return
my_add3
(
2
,
4
)
def
test_wraparound
():
"""
>>> test_wraparound()
1.0
"""
# the wraparound directive from this scope should not affect the inline pxd
a
=
[
0.0
,
1.0
]
return
inlinepxd_support
.
index
(
a
)
tests/run/inlinepxd_support.pxd
View file @
bac20ea8
cdef
inline
int
my_add
(
int
a
,
int
b
=
1
,
int
c
=
0
):
return
a
+
b
+
c
cdef
inline
index
(
list
L
):
# This function should *not* be affected by directives set in the outer scope, such as "wraparound".
# See https://github.com/cython/cython/issues/1071
return
L
[
-
1
]
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