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
fb7aeee3
Commit
fb7aeee3
authored
May 31, 2019
by
gsamain
Committed by
Xavier Thompson
Jun 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SimpleCallNode correctly report the needed lock for arguments
parent
90a4f954
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+14
-7
No files found.
Cython/Compiler/ExprNodes.py
View file @
fb7aeee3
...
@@ -725,7 +725,7 @@ class ExprNode(Node):
...
@@ -725,7 +725,7 @@ class ExprNode(Node):
if
hasattr
(
self
,
'entry'
)
and
self
.
entry
.
type
.
is_cyp_class
and
self
.
entry
.
is_variable
\
if
hasattr
(
self
,
'entry'
)
and
self
.
entry
.
type
.
is_cyp_class
and
self
.
entry
.
is_variable
\
and
not
(
self
.
entry
.
is_rlocked
or
self
.
entry
.
is_wlocked
):
and
not
(
self
.
entry
.
is_rlocked
or
self
.
entry
.
is_wlocked
):
if
self
.
entry
.
type
.
lock_mode
==
"autolock"
:
if
self
.
entry
.
type
.
lock_mode
==
"autolock"
:
print
"Request read lock autolock here"
print
"Request read lock autolock here"
,
self
.
entry
.
name
self
.
entry
.
is_rlocked
=
True
self
.
entry
.
is_rlocked
=
True
self
.
entry
.
locking_node
.
needs_rlock
=
True
self
.
entry
.
locking_node
.
needs_rlock
=
True
elif
self
.
entry
.
type
.
lock_mode
==
"checklock"
:
elif
self
.
entry
.
type
.
lock_mode
==
"checklock"
:
...
@@ -5903,6 +5903,14 @@ class SimpleCallNode(CallNode):
...
@@ -5903,6 +5903,14 @@ class SimpleCallNode(CallNode):
arg
.
exact_builtin_type
=
False
arg
.
exact_builtin_type
=
False
args
[
0
]
=
arg
args
[
0
]
=
arg
# Check for args locks: read-lock for const args, write-locks for other
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
formal_arg
=
func_type
.
args
[
i
]
actual_arg
=
args
[
i
]
if
formal_arg
.
type
.
is_const
:
actual_arg
.
check_rhs_locked
(
env
)
else
:
actual_arg
.
check_lhs_locked
(
env
)
# Coerce arguments
# Coerce arguments
some_args_in_temps
=
False
some_args_in_temps
=
False
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
for
i
in
range
(
min
(
max_nargs
,
actual_nargs
)):
...
@@ -6025,6 +6033,11 @@ class SimpleCallNode(CallNode):
...
@@ -6025,6 +6033,11 @@ class SimpleCallNode(CallNode):
self
.
overflowcheck
=
env
.
directives
[
'overflowcheck'
]
self
.
overflowcheck
=
env
.
directives
[
'overflowcheck'
]
def
check_rhs_locked
(
self
,
env
):
self
.
function
.
check_rhs_locked
(
env
)
#if not self.is_rhs_locked(env):
# error(self.pos, "RHS lock needed")
def
calculate_result_code
(
self
):
def
calculate_result_code
(
self
):
return
self
.
c_call_code
()
return
self
.
c_call_code
()
...
@@ -6163,9 +6176,6 @@ class SimpleCallNode(CallNode):
...
@@ -6163,9 +6176,6 @@ class SimpleCallNode(CallNode):
exc_checks
.
append
(
"__Pyx_ErrOccurredWithGIL()"
)
exc_checks
.
append
(
"__Pyx_ErrOccurredWithGIL()"
)
else
:
else
:
exc_checks
.
append
(
"PyErr_Occurred()"
)
exc_checks
.
append
(
"PyErr_Occurred()"
)
for
arg
in
self
.
args
:
if
arg
.
type
.
is_cyp_class
and
arg
.
type
.
lock_mode
==
"autolock"
:
code
.
putln
(
"Cy_WLOCK(%s);"
%
arg
.
result
())
if
self
.
is_temp
or
exc_checks
:
if
self
.
is_temp
or
exc_checks
:
rhs
=
self
.
c_call_code
()
rhs
=
self
.
c_call_code
()
if
self
.
result
():
if
self
.
result
():
...
@@ -7332,10 +7342,7 @@ class AttributeNode(ExprNode):
...
@@ -7332,10 +7342,7 @@ class AttributeNode(ExprNode):
# The subexpr mechanism will here issue check_rhs_lock on self.obj
# The subexpr mechanism will here issue check_rhs_lock on self.obj
# BUT if we are calling a non-const method, the object can be modified.
# BUT if we are calling a non-const method, the object can be modified.
# So here we're calling directly check_lhs_lock if this is needed.
# So here we're calling directly check_lhs_lock if this is needed.
if
self
.
entry
.
is_cfunction
and
self
.
entry
.
type
.
is_const_method
:
print
self
.
entry
.
name
,
"const method in rhs check detected !"
if
self
.
entry
.
is_cfunction
and
not
self
.
entry
.
type
.
is_const_method
:
if
self
.
entry
.
is_cfunction
and
not
self
.
entry
.
type
.
is_const_method
:
print
self
.
entry
.
name
,
"is considered a non const method"
self
.
obj
.
check_lhs_locked
(
env
)
self
.
obj
.
check_lhs_locked
(
env
)
return
ExprNode
.
is_rhs_locked
(
self
,
env
)
return
ExprNode
.
is_rhs_locked
(
self
,
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