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
Xavier Thompson
cython
Commits
321b3d1e
Commit
321b3d1e
authored
Nov 06, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use temporaries to prevent nested cypclass lock acquisition
parent
af8dcdb3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
Cython/Compiler/CypclassTransforms.py
Cython/Compiler/CypclassTransforms.py
+21
-2
No files found.
Cython/Compiler/CypclassTransforms.py
View file @
321b3d1e
...
...
@@ -445,10 +445,12 @@ class CypclassLockTransform(Visitor.EnvTransform):
error
(
lock
.
pos
,
"A writelock is required, but a readlock is manually acquired"
)
return
obj
except
:
self
.
autolocks
+=
1
return
ExprNodes
.
CoerceToLockedNode
(
obj
,
self
.
current_env
(),
rlock_only
=
not
exclusive
)
def
__call__
(
self
,
root
):
self
.
locked
=
{}
self
.
autolocks
=
0
return
super
(
CypclassLockTransform
,
self
).
__call__
(
root
)
def
visit_Node
(
self
,
node
):
...
...
@@ -495,6 +497,21 @@ class CypclassLockTransform(Visitor.EnvTransform):
node
.
obj
=
self
.
lock
(
node
.
obj
,
exclusive
=
node
.
is_target
)
return
node
def
visit_value
(
self
,
node
):
if
node
is
None
:
return
None
autolocks
=
self
.
autolocks
node
=
self
.
visit
(
node
)
if
self
.
autolocks
>
autolocks
:
self
.
autolocks
=
0
return
node
.
coerce_to_temp
(
self
.
current_env
())
return
node
def
visit_IndexNode
(
self
,
node
):
node
.
index
=
self
.
visit_value
(
node
.
index
)
node
.
base
=
self
.
visit
(
node
.
base
)
return
node
def
visit_DelStatNode
(
self
,
node
):
for
arg
in
node
.
args
:
arg_entry
=
self
.
id
(
arg
)
...
...
@@ -511,7 +528,8 @@ class CypclassLockTransform(Visitor.EnvTransform):
# Disallow re-binding a locked name
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
return
node
self
.
visitchildren
(
node
)
node
.
rhs
=
self
.
visit_value
(
node
.
rhs
)
self
.
visitchildren
(
node
,
exclude
=
[
'rhs'
])
return
node
def
visit_CascadedAssignmentNode
(
self
,
node
):
...
...
@@ -520,7 +538,8 @@ class CypclassLockTransform(Visitor.EnvTransform):
# Disallow re-binding a locked name
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
return
node
self
.
visitchildren
(
node
)
node
.
rhs
=
self
.
visit_value
(
node
.
rhs
)
self
.
visitchildren
(
node
,
exclude
=
[
'rhs'
])
return
node
def
visit_WithTargetAssignmentStatNode
(
self
,
node
):
...
...
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