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
9a50e59c
Commit
9a50e59c
authored
Jul 02, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make auto-unlock work correctly with not-assigned expressions
parent
a6f398f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+6
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
9a50e59c
...
@@ -715,8 +715,6 @@ class ExprNode(Node):
...
@@ -715,8 +715,6 @@ class ExprNode(Node):
self
.
tracked_state
=
env
.
lookup_tracked
(
self
.
entry
)
self
.
tracked_state
=
env
.
lookup_tracked
(
self
.
entry
)
if
self
.
tracked_state
is
None
:
if
self
.
tracked_state
is
None
:
self
.
tracked_state
=
env
.
declare_tracked
(
self
.
entry
)
self
.
tracked_state
=
env
.
declare_tracked
(
self
.
entry
)
if
self
.
is_autolock
():
env
.
declare_autolocked
(
self
)
self
.
was_locked
=
self
.
tracked_state
.
was_locked
self
.
was_locked
=
self
.
tracked_state
.
was_locked
self
.
tracked_state
.
was_locked
=
True
self
.
tracked_state
.
was_locked
=
True
...
@@ -753,13 +751,15 @@ class ExprNode(Node):
...
@@ -753,13 +751,15 @@ class ExprNode(Node):
elif
self
.
is_autolock
():
elif
self
.
is_autolock
():
self
.
set_autorlock
(
env
)
self
.
set_autorlock
(
env
)
def
ensure_lhs_locked
(
self
,
env
,
is_dereferenced
=
False
):
def
ensure_lhs_locked
(
self
,
env
,
is_dereferenced
=
False
,
is_top_lhs
=
False
):
if
not
is_dereferenced
:
if
not
is_dereferenced
:
self
.
ensure_subexpr_lhs_locked
(
env
)
self
.
ensure_subexpr_lhs_locked
(
env
)
else
:
else
:
self
.
ensure_subexpr_rhs_locked
(
env
)
self
.
ensure_subexpr_rhs_locked
(
env
)
if
not
self
.
tracked_state
:
if
not
self
.
tracked_state
:
self
.
get_tracked_state
(
env
)
self
.
get_tracked_state
(
env
)
if
self
.
is_autolock
()
and
is_top_lhs
:
env
.
declare_autolocked
(
self
)
if
is_dereferenced
and
self
.
tracked_state
:
if
is_dereferenced
and
self
.
tracked_state
:
if
not
self
.
is_lhs_locked
(
env
):
if
not
self
.
is_lhs_locked
(
env
):
if
self
.
is_checklock
():
if
self
.
is_checklock
():
...
@@ -7461,6 +7461,9 @@ class AttributeNode(ExprNode):
...
@@ -7461,6 +7461,9 @@ class AttributeNode(ExprNode):
code
.
putln
(
"%s.memview = NULL;"
%
self
.
result
())
code
.
putln
(
"%s.memview = NULL;"
%
self
.
result
())
code
.
putln
(
"%s.data = NULL;"
%
self
.
result
())
code
.
putln
(
"%s.data = NULL;"
%
self
.
result
())
else
:
else
:
if
self
.
is_temp
and
self
.
type
.
is_cyp_class
and
self
.
is_autolock
()
\
and
self
.
tracked_state
and
(
tracked_state
.
needs_rlock
or
tracked_state
.
needs_wlock
):
code
.
putln
(
"Cy_UNLOCK(%s);"
%
self
.
result
())
ExprNode
.
generate_disposal_code
(
self
,
code
)
ExprNode
.
generate_disposal_code
(
self
,
code
)
def
generate_assignment_code
(
self
,
rhs
,
code
,
overloaded_assignment
=
False
,
def
generate_assignment_code
(
self
,
rhs
,
code
,
overloaded_assignment
=
False
,
...
...
Cython/Compiler/Nodes.py
View file @
9a50e59c
...
@@ -5568,7 +5568,7 @@ class SingleAssignmentNode(AssignmentNode):
...
@@ -5568,7 +5568,7 @@ class SingleAssignmentNode(AssignmentNode):
self
.
lhs
=
self
.
lhs
.
analyse_target_types
(
env
)
self
.
lhs
=
self
.
lhs
.
analyse_target_types
(
env
)
self
.
lhs
.
gil_assignment_check
(
env
)
self
.
lhs
.
gil_assignment_check
(
env
)
self
.
rhs
.
ensure_rhs_locked
(
env
)
self
.
rhs
.
ensure_rhs_locked
(
env
)
self
.
lhs
.
ensure_lhs_locked
(
env
)
self
.
lhs
.
ensure_lhs_locked
(
env
,
is_top_lhs
=
True
)
unrolled_assignment
=
self
.
unroll_lhs
(
env
)
unrolled_assignment
=
self
.
unroll_lhs
(
env
)
if
unrolled_assignment
:
if
unrolled_assignment
:
return
unrolled_assignment
return
unrolled_assignment
...
@@ -5792,7 +5792,7 @@ class CascadedAssignmentNode(AssignmentNode):
...
@@ -5792,7 +5792,7 @@ class CascadedAssignmentNode(AssignmentNode):
for
i
,
lhs
in
enumerate
(
self
.
lhs_list
):
for
i
,
lhs
in
enumerate
(
self
.
lhs_list
):
lhs
=
self
.
lhs_list
[
i
]
=
lhs
.
analyse_target_types
(
env
)
lhs
=
self
.
lhs_list
[
i
]
=
lhs
.
analyse_target_types
(
env
)
lhs
.
gil_assignment_check
(
env
)
lhs
.
gil_assignment_check
(
env
)
lhs
.
ensure_lhs_locked
(
env
)
lhs
.
ensure_lhs_locked
(
env
,
is_top_lhs
=
True
)
lhs_types
.
add
(
lhs
.
type
)
lhs_types
.
add
(
lhs
.
type
)
rhs
=
self
.
rhs
.
analyse_types
(
env
)
rhs
=
self
.
rhs
.
analyse_types
(
env
)
...
...
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