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
510e786b
Commit
510e786b
authored
Nov 09, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure automatic cypclass write lock acquisition is not nested
parent
565e6b4f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
Cython/Compiler/CypclassTransforms.py
Cython/Compiler/CypclassTransforms.py
+21
-19
No files found.
Cython/Compiler/CypclassTransforms.py
View file @
510e786b
...
@@ -446,11 +446,13 @@ class CypclassLockTransform(Visitor.EnvTransform):
...
@@ -446,11 +446,13 @@ class CypclassLockTransform(Visitor.EnvTransform):
return
obj
return
obj
except
:
except
:
self
.
autolocks
+=
1
self
.
autolocks
+=
1
self
.
autowlocks
+=
exclusive
return
ExprNodes
.
CoerceToLockedNode
(
obj
,
self
.
current_env
(),
rlock_only
=
not
exclusive
)
return
ExprNodes
.
CoerceToLockedNode
(
obj
,
self
.
current_env
(),
rlock_only
=
not
exclusive
)
def
__call__
(
self
,
root
):
def
__call__
(
self
,
root
):
self
.
locked
=
{}
self
.
locked
=
{}
self
.
autolocks
=
0
self
.
autolocks
=
0
self
.
autowlocks
=
0
return
super
(
CypclassLockTransform
,
self
).
__call__
(
root
)
return
super
(
CypclassLockTransform
,
self
).
__call__
(
root
)
def
visit_Node
(
self
,
node
):
def
visit_Node
(
self
,
node
):
...
@@ -503,24 +505,16 @@ class CypclassLockTransform(Visitor.EnvTransform):
...
@@ -503,24 +505,16 @@ class CypclassLockTransform(Visitor.EnvTransform):
autolocks
=
self
.
autolocks
autolocks
=
self
.
autolocks
node
=
self
.
visit
(
node
)
node
=
self
.
visit
(
node
)
if
self
.
autolocks
>
autolocks
:
if
self
.
autolocks
>
autolocks
:
self
.
autolocks
=
0
return
node
.
coerce_to_temp
(
self
.
current_env
())
return
node
.
coerce_to_temp
(
self
.
current_env
())
return
node
return
node
def
visit_IndexNode
(
self
,
node
):
def
visit_assignment
(
self
,
node
):
node
.
index
=
self
.
visit_value
(
node
.
index
)
autowlocks
=
self
.
autowlocks
node
.
base
=
self
.
visit
(
node
.
base
)
self
.
visitchildren
(
node
,
exclude
=
[
'rhs'
])
return
node
if
self
.
autowlocks
>
autowlocks
:
node
.
rhs
=
self
.
visit_value
(
node
.
rhs
)
def
visit_DelStatNode
(
self
,
node
):
else
:
for
arg
in
node
.
args
:
node
.
rhs
=
self
.
visit
(
node
.
rhs
)
arg_entry
=
self
.
id
(
arg
)
if
arg_entry
in
self
.
locked
:
# Disallow unbinding a locked name
error
(
arg
.
pos
,
"Deleting a locked cypclass reference"
)
return
node
self
.
visitchildren
(
node
)
return
node
def
visit_SingleAssignmentNode
(
self
,
node
):
def
visit_SingleAssignmentNode
(
self
,
node
):
lhs
=
node
.
lhs
lhs
=
node
.
lhs
...
@@ -528,8 +522,7 @@ class CypclassLockTransform(Visitor.EnvTransform):
...
@@ -528,8 +522,7 @@ class CypclassLockTransform(Visitor.EnvTransform):
# Disallow re-binding a locked name
# Disallow re-binding a locked name
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
return
node
return
node
node
.
rhs
=
self
.
visit_value
(
node
.
rhs
)
self
.
visit_assignment
(
node
)
self
.
visitchildren
(
node
,
exclude
=
[
'rhs'
])
return
node
return
node
def
visit_CascadedAssignmentNode
(
self
,
node
):
def
visit_CascadedAssignmentNode
(
self
,
node
):
...
@@ -538,8 +531,17 @@ class CypclassLockTransform(Visitor.EnvTransform):
...
@@ -538,8 +531,17 @@ class CypclassLockTransform(Visitor.EnvTransform):
# Disallow re-binding a locked name
# Disallow re-binding a locked name
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
error
(
lhs
.
pos
,
"Assigning to a locked cypclass reference"
)
return
node
return
node
node
.
rhs
=
self
.
visit_value
(
node
.
rhs
)
self
.
visit_assignment
(
node
)
self
.
visitchildren
(
node
,
exclude
=
[
'rhs'
])
return
node
def
visit_DelStatNode
(
self
,
node
):
for
arg
in
node
.
args
:
arg_entry
=
self
.
id
(
arg
)
if
arg_entry
in
self
.
locked
:
# Disallow unbinding a locked name
error
(
arg
.
pos
,
"Deleting a locked cypclass reference"
)
return
node
self
.
visitchildren
(
node
)
return
node
return
node
def
visit_WithTargetAssignmentStatNode
(
self
,
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