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
673e8007
Commit
673e8007
authored
Dec 31, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mark infinite while loops as terminators when looking for unreachable code
parent
07e66a55
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+6
-0
tests/errors/w_unreachable.pyx
tests/errors/w_unreachable.pyx
+5
-0
No files found.
Cython/Compiler/ParseTreeTransforms.py
View file @
673e8007
...
...
@@ -2162,6 +2162,12 @@ class RemoveUnreachableCode(CythonTransform):
node
.
is_terminator
=
True
return
node
def
visit_WhileStatNode
(
self
,
node
):
self
.
visitchildren
(
node
)
if
not
node
.
condition
:
node
.
is_terminator
=
True
return
node
def
visit_TryExceptStatNode
(
self
,
node
):
self
.
visitchildren
(
node
)
if
node
.
body
.
is_terminator
and
node
.
else_clause
:
...
...
tests/errors/w_unreachable.pyx
View file @
673e8007
...
...
@@ -31,6 +31,10 @@ def try_except():
else
:
print
'unreachable'
def
infinite_loops
():
while
True
:
pass
print
'Never be here'
_ERRORS
=
"""
6:4: Unreachable code
...
...
@@ -38,4 +42,5 @@ _ERRORS = """
15:8: Unreachable code
24:4: Unreachable code
32:8: Unreachable code
37:4: Unreachable code
"""
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