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
d724cd00
Commit
d724cd00
authored
May 25, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow conversion to PyObject only when supported (e.g. not for templated cypclasses)
parent
4fd45787
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+7
-1
No files found.
Cython/Compiler/Nodes.py
View file @
d724cd00
...
...
@@ -1636,7 +1636,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
cclass_bases
=
TupleNode
(
self
.
pos
,
args
=
[])
if
self
.
templates
:
print
(
"Quick warning: Python wrappers for templated cypclasses are not supported yet"
)
# Python wrapper for templated cypclasses not supported yet
# this is signaled to the compiler by not doing what is below
return
if
self
.
attributes
is
not
None
:
...
...
Cython/Compiler/PyrexTypes.py
View file @
d724cd00
...
...
@@ -4178,7 +4178,7 @@ class CypClassType(CppClassType):
# wrapper_type PyExtensionType or None the type of the cclass wrapper
is_cyp_class
=
1
to_py_function
=
"__Pyx_PyObject_FromCyObject"
to_py_function
=
None
def
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
=
None
,
template_type
=
None
,
nogil
=
0
,
lock_mode
=
None
,
activable
=
False
):
CppClassType
.
__init__
(
self
,
name
,
scope
,
cname
,
base_classes
,
templates
,
template_type
,
nogil
)
...
...
@@ -4207,6 +4207,12 @@ class CypClassType(CppClassType):
self
.
_mro
=
mro_C3_merge
(
inputs
)
return
self
.
_mro
# allow conversion to Python only when wrapping is supported
def
create_to_py_utility_code
(
self
,
env
):
if
not
self
.
wrapper_type
:
return
False
self
.
to_py_function
=
"__Pyx_PyObject_FromCyObject"
return
True
def
empty_declaration_code
(
self
):
if
self
.
_empty_declaration
is
None
:
...
...
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