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
2db7ac1d
Commit
2db7ac1d
authored
Jun 06, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do lock analysis on statement nodes other than basic assignments (while, for, ...)
parent
d1dc1a62
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+13
-0
No files found.
Cython/Compiler/Nodes.py
View file @
2db7ac1d
...
...
@@ -5934,7 +5934,9 @@ class InPlaceAssignmentNode(AssignmentNode):
def
analyse_types
(
self
,
env
):
self
.
rhs
=
self
.
rhs
.
analyse_types
(
env
)
self
.
rhs
.
ensure_rhs_locked
(
env
)
self
.
lhs
=
self
.
lhs
.
analyse_target_types
(
env
)
self
.
rhs
.
ensure_lhs_locked
(
env
)
# When assigning to a fully indexed buffer or memoryview, coerce the rhs
if
self
.
lhs
.
is_memview_index
or
self
.
lhs
.
is_buffer_access
:
...
...
@@ -5997,6 +5999,7 @@ class PrintStatNode(StatNode):
stream
=
self
.
stream
.
analyse_expressions
(
env
)
self
.
stream
=
stream
.
coerce_to_pyobject
(
env
)
arg_tuple
=
self
.
arg_tuple
.
analyse_expressions
(
env
)
arg_tuple
.
ensure_rhs_locked
(
env
)
self
.
arg_tuple
=
arg_tuple
.
coerce_to_pyobject
(
env
)
env
.
use_utility_code
(
printing_utility_code
)
if
len
(
self
.
arg_tuple
.
args
)
==
1
and
self
.
append_newline
:
...
...
@@ -6106,6 +6109,7 @@ class DelStatNode(StatNode):
def
analyse_expressions
(
self
,
env
):
for
i
,
arg
in
enumerate
(
self
.
args
):
arg
=
self
.
args
[
i
]
=
arg
.
analyse_target_expression
(
env
,
None
)
arg
.
ensure_lhs_locked
(
env
)
if
arg
.
type
.
is_pyobject
or
(
arg
.
is_name
and
arg
.
type
.
is_memoryviewslice
):
if
arg
.
is_name
and
arg
.
entry
.
is_cglobal
:
error
(
arg
.
pos
,
"Deletion of global C variable"
)
...
...
@@ -6233,6 +6237,7 @@ class ReturnStatNode(StatNode):
if
self
.
in_async_gen
:
error
(
self
.
pos
,
"Return with value in async generator"
)
self
.
value
=
self
.
value
.
analyse_types
(
env
)
self
.
value
.
ensure_rhs_locked
(
env
)
if
return_type
.
is_void
or
return_type
.
is_returncode
:
error
(
self
.
value
.
pos
,
"Return with value in void function"
)
else
:
...
...
@@ -6600,6 +6605,7 @@ class IfClauseNode(Node):
def
analyse_expressions
(
self
,
env
):
self
.
condition
=
self
.
condition
.
analyse_temp_boolean_expression
(
env
)
self
.
condition
.
ensure_rhs_locked
(
env
)
self
.
body
=
self
.
body
.
analyse_expressions
(
env
)
return
self
...
...
@@ -6729,6 +6735,7 @@ class WhileStatNode(LoopNode, StatNode):
def
analyse_expressions
(
self
,
env
):
if
self
.
condition
:
self
.
condition
=
self
.
condition
.
analyse_temp_boolean_expression
(
env
)
self
.
condition
.
ensure_rhs_locked
(
env
)
self
.
body
=
self
.
body
.
analyse_expressions
(
env
)
if
self
.
else_clause
:
self
.
else_clause
=
self
.
else_clause
.
analyse_expressions
(
env
)
...
...
@@ -6960,7 +6967,9 @@ class _ForInStatNode(LoopNode, StatNode):
def
analyse_expressions
(
self
,
env
):
self
.
target
=
self
.
target
.
analyse_target_types
(
env
)
self
.
target
.
ensure_lhs_locked
(
env
)
self
.
iterator
=
self
.
iterator
.
analyse_expressions
(
env
)
self
.
iterator
.
ensure_rhs_locked
(
env
)
self
.
_create_item_node
()
# must rewrap self.item after analysis
self
.
item
=
self
.
item
.
analyse_expressions
(
env
)
if
(
not
self
.
is_async
and
...
...
@@ -7102,13 +7111,17 @@ class ForFromStatNode(LoopNode, StatNode):
def
analyse_expressions
(
self
,
env
):
from
.
import
ExprNodes
self
.
target
=
self
.
target
.
analyse_target_types
(
env
)
self
.
target
.
ensure_lhs_locked
(
env
)
self
.
bound1
=
self
.
bound1
.
analyse_types
(
env
)
self
.
bound1
.
ensure_rhs_locked
(
env
)
self
.
bound2
=
self
.
bound2
.
analyse_types
(
env
)
self
.
bound2
.
ensure_rhs_locked
(
env
)
if
self
.
step
is
not
None
:
if
isinstance
(
self
.
step
,
ExprNodes
.
UnaryMinusNode
):
warning
(
self
.
step
.
pos
,
"Probable infinite loop in for-from-by statement. "
"Consider switching the directions of the relations."
,
2
)
self
.
step
=
self
.
step
.
analyse_types
(
env
)
self
.
step
.
ensure_rhs_locked
(
env
)
self
.
set_up_loop
(
env
)
target_type
=
self
.
target
.
type
...
...
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