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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
bb5b945f
Commit
bb5b945f
authored
Jul 02, 2019
by
gsamain
Committed by
Xavier Thompson
Aug 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make auto-unlock work correctly with not-assigned expressions
parent
98920e36
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 @
bb5b945f
...
@@ -747,8 +747,6 @@ class ExprNode(Node):
...
@@ -747,8 +747,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
...
@@ -785,13 +783,15 @@ class ExprNode(Node):
...
@@ -785,13 +783,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
():
...
@@ -7616,6 +7616,9 @@ class AttributeNode(ExprNode):
...
@@ -7616,6 +7616,9 @@ class AttributeNode(ExprNode):
# mirror condition for putting the memview incref here:
# mirror condition for putting the memview incref here:
code
.
put_xdecref_clear
(
self
.
result
(),
self
.
type
,
have_gil
=
True
)
code
.
put_xdecref_clear
(
self
.
result
(),
self
.
type
,
have_gil
=
True
)
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 @
bb5b945f
...
@@ -5814,7 +5814,7 @@ class SingleAssignmentNode(AssignmentNode):
...
@@ -5814,7 +5814,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
...
@@ -6038,7 +6038,7 @@ class CascadedAssignmentNode(AssignmentNode):
...
@@ -6038,7 +6038,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