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
395782ae
Commit
395782ae
authored
May 27, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lock inside wrapper methods when the underlying cypclass is in checklock mode
parent
02b256cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+15
-3
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+3
-0
No files found.
Cython/Compiler/Nodes.py
View file @
395782ae
...
...
@@ -1652,7 +1652,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
if
not
skipped_self
:
return
# if this ever happens (?), skip non-static methods without a self argument
cfunc_return_type
=
cfunc_method
.
type
.
return_type
cfunc_type
=
cfunc_method
.
type
cfunc_return_type
=
cfunc_type
.
return_type
# we pass the global scope as argument, should not affect the result (?)
if
not
cfunc_return_type
.
can_coerce_to_pyobject
(
env
.
global_scope
()):
...
...
@@ -1714,11 +1715,22 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
# > return the result of the call if the underlying return type is not void
if
cfunc_return_type
.
is_void
:
py_stat
=
ExprStatNode
(
pos
=
cfunc_method
.
pos
,
expr
=
c_call
)
py_stat
=
ExprStatNode
(
cfunc_method
.
pos
,
expr
=
c_call
)
else
:
py_stat
=
ReturnStatNode
(
pos
=
cfunc_method
.
pos
,
return_type
=
PyrexTypes
.
py_object_type
,
value
=
c_call
)
py_stat
=
ReturnStatNode
(
cfunc_method
.
pos
,
return_type
=
PyrexTypes
.
py_object_type
,
value
=
c_call
)
py_body
=
StatListNode
(
cfunc_method
.
pos
,
stats
=
[
py_stat
])
# > lock around the call in checklock mode
if
self
.
lock_mode
==
'checklock'
:
need_wlock
=
not
cfunc_type
.
is_const_method
lock_node
=
LockCypclassNode
(
cfunc_method
.
pos
,
state
=
'wlocked'
if
need_wlock
else
'rlocked'
,
obj
=
underlying_obj
,
body
=
py_body
)
py_body
=
lock_node
# > the wrapper method
return
DefNode
(
cfunc_method
.
pos
,
...
...
Cython/Compiler/PyrexTypes.py
View file @
395782ae
...
...
@@ -3993,6 +3993,9 @@ class CypClassType(CppClassType):
return
self
.
_mro
# allow conversion to Python only when there is a wrapper type
def
can_coerce_to_pyobject
(
self
,
env
):
return
self
.
wrapper_type
is
not
None
def
create_to_py_utility_code
(
self
,
env
):
if
not
self
.
wrapper_type
:
return
False
...
...
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