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
97474dca
Commit
97474dca
authored
May 27, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid wrapping cypclass methods with Python-incompatible argument types
parent
4a3eefc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+9
-1
No files found.
Cython/Compiler/Nodes.py
View file @
97474dca
...
@@ -1646,7 +1646,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -1646,7 +1646,7 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
cfunc_declarator
=
cfunc_method
.
cfunc_declarator
cfunc_declarator
=
cfunc_method
.
cfunc_declarator
#
C
++ methods have an implict 'this', so the 'self' argument is skipped in the declarator
#
> c
++ methods have an implict 'this', so the 'self' argument is skipped in the declarator
skipped_self
=
cfunc_declarator
.
skipped_self
skipped_self
=
cfunc_declarator
.
skipped_self
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
...
@@ -1654,10 +1654,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
...
@@ -1654,10 +1654,18 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
cfunc_type
=
cfunc_method
.
type
cfunc_type
=
cfunc_method
.
type
cfunc_return_type
=
cfunc_type
.
return_type
cfunc_return_type
=
cfunc_type
.
return_type
# > TODO: the Python-incompatibility is too conservative:
# some types have not yet resolved that they can coerce to PyObject
# in particular, any cypclass not yet examined ?
# 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
()):
return
# skip c methods with Python-incompatible return types
return
# skip c methods with Python-incompatible return types
for
argtype
in
cfunc_type
.
args
:
if
not
argtype
.
type
.
can_coerce_to_pyobject
(
env
.
global_scope
()):
return
# skip c methods with Python-incompatible argument types
from
.CypclassWrapper
import
underlying_name
from
.CypclassWrapper
import
underlying_name
from
.
import
ExprNodes
from
.
import
ExprNodes
...
...
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