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
69fdc363
Commit
69fdc363
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
cc937270
Changes
2
Show 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 @
69fdc363
...
@@ -1652,7 +1652,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -1652,7 +1652,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
if
not
skipped_self
:
if
not
skipped_self
:
return
# if this ever happens (?), skip non-static methods without a self argument
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 (?)
# we pass the global scope as argument, should not affect the result (?)
if
not
cfunc_return_type
.
can_coerce_to_pyobject
(
env
.
global_scope
()):
if
not
cfunc_return_type
.
can_coerce_to_pyobject
(
env
.
global_scope
()):
...
@@ -1714,11 +1715,22 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -1714,11 +1715,22 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
# > return the result of the call if the underlying return type is not void
# > return the result of the call if the underlying return type is not void
if
cfunc_return_type
.
is_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
:
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
])
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
# > the wrapper method
return
DefNode
(
return
DefNode
(
cfunc_method
.
pos
,
cfunc_method
.
pos
,
...
...
Cython/Compiler/PyrexTypes.py
View file @
69fdc363
...
@@ -4027,6 +4027,9 @@ class CypClassType(CppClassType):
...
@@ -4027,6 +4027,9 @@ class CypClassType(CppClassType):
return
path
return
path
# allow conversion to Python only when there is a wrapper type
# 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
):
def
create_to_py_utility_code
(
self
,
env
):
if
not
self
.
wrapper_type
:
if
not
self
.
wrapper_type
:
return
False
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