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
Gwenaël Samain
cython
Commits
f70465bd
Commit
f70465bd
authored
May 09, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a little bug for break/continue in parallel sections
parent
8e05843a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
10 deletions
+40
-10
Cython/Compiler/TypeInference.py
Cython/Compiler/TypeInference.py
+40
-10
No files found.
Cython/Compiler/TypeInference.py
View file @
f70465bd
...
...
@@ -23,6 +23,9 @@ object_expr = TypedExprNode(py_object_type)
class
MarkAssignments
(
CythonTransform
):
# tells us whether we're in a normal loop
in_loop
=
False
def
__init__
(
self
,
context
):
super
(
CythonTransform
,
self
).
__init__
()
self
.
context
=
context
...
...
@@ -115,7 +118,8 @@ class MarkAssignments(CythonTransform):
node
.
pos
,
base
=
sequence
,
index
=
ExprNodes
.
IntNode
(
node
.
pos
,
value
=
'0'
)))
self
.
visitchildren
(
node
)
self
.
_visit_loop_node_children
(
node
)
return
node
def
visit_ForFromStatNode
(
self
,
node
):
...
...
@@ -126,7 +130,11 @@ class MarkAssignments(CythonTransform):
'+'
,
node
.
bound1
,
node
.
step
))
self
.
visitchildren
(
node
)
self
.
_visit_loop_node_children
(
node
)
return
node
def
visit_WhileStatNode
(
self
,
node
):
self
.
_visit_loop_node_children
(
node
)
return
node
def
visit_ExceptClauseNode
(
self
,
node
):
...
...
@@ -195,20 +203,22 @@ class MarkAssignments(CythonTransform):
return
node
def
visit_BreakStatNode
(
self
,
node
):
parnode
=
self
.
parallel_block_stack
[
-
1
]
parnode
.
break_label_used
=
True
if
self
.
parallel_block_stack
:
parnode
=
self
.
parallel_block_stack
[
-
1
]
parnode
.
break_label_used
=
True
if
not
parnode
.
is_prange
and
parnode
.
parent
:
parnode
.
parent
.
break_label_used
=
True
if
not
parnode
.
is_prange
and
parnode
.
parent
:
parnode
.
parent
.
break_label_used
=
True
return
node
def
visit_ContinueStatNode
(
self
,
node
):
parnode
=
self
.
parallel_block_stack
[
-
1
]
parnode
.
continue_label_used
=
True
if
self
.
parallel_block_stack
:
parnode
=
self
.
parallel_block_stack
[
-
1
]
parnode
.
continue_label_used
=
True
if
not
parnode
.
is_prange
and
parnode
.
parent
:
parnode
.
parent
.
continue_label_used
=
True
if
not
parnode
.
is_prange
and
parnode
.
parent
:
parnode
.
parent
.
continue_label_used
=
True
return
node
...
...
@@ -225,6 +235,26 @@ class MarkAssignments(CythonTransform):
return
node
def
_visit_loop_node_children
(
self
,
node
):
"""
Used for the children of "loop nodes", like ForInStatNode, so subnodes
can establish whether break and continue belong to a parallel node
or something else.
"""
child_attrs
=
node
.
child_attrs
node
.
child_attrs
=
[
attr
for
attr
in
child_attrs
if
attr
!=
'else_clause'
]
was_in_loop
=
self
.
in_loop
self
.
in_loop
=
True
self
.
visitchildren
(
node
)
self
.
in_loop
=
was_in_loop
node
.
child_attrs
=
child_attrs
if
node
.
else_clause
:
node
.
else_clause
=
self
.
visit
(
node
.
else_clause
)
class
MarkOverflowingArithmetic
(
CythonTransform
):
...
...
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