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
59546849
Commit
59546849
authored
May 22, 2021
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a crash when compiling a module without statements, only a single declaration.
parent
2570b55e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+7
-0
tests/compile/fused_unused.pyx
tests/compile/fused_unused.pyx
+9
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
59546849
...
...
@@ -79,6 +79,13 @@ class NormalizeTree(CythonTransform):
self
.
is_in_statlist
=
False
self
.
is_in_expr
=
False
def
visit_ModuleNode
(
self
,
node
):
self
.
visitchildren
(
node
)
if
not
isinstance
(
node
.
body
,
Nodes
.
StatListNode
):
# This can happen when the body only consists of a single (unused) declaration and no statements.
node
.
body
=
Nodes
.
StatListNode
(
pos
=
node
.
pos
,
stats
=
[
node
.
body
])
return
node
def
visit_ExprNode
(
self
,
node
):
stacktmp
=
self
.
is_in_expr
self
.
is_in_expr
=
True
...
...
tests/compile/fused_unused.pyx
0 → 100644
View file @
59546849
# mode: compile
# tag: fused
# This previously lead to a crash due to an empty module body.
ctypedef
fused
cinteger
:
int
long
Py_ssize_t
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