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
Kirill Smelkov
cython
Commits
4d2a3233
Commit
4d2a3233
authored
Aug 16, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
fd728734
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+1
-1
Cython/Compiler/Pipeline.py
Cython/Compiler/Pipeline.py
+1
-1
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+24
-13
No files found.
Cython/Compiler/ExprNodes.py
View file @
4d2a3233
...
@@ -7462,7 +7462,7 @@ class SequenceNode(ExprNode):
...
@@ -7462,7 +7462,7 @@ class SequenceNode(ExprNode):
', '
.
join
(
arg
.
py_result
()
for
arg
in
self
.
args
),
', '
.
join
(
arg
.
py_result
()
for
arg
in
self
.
args
),
code
.
error_goto_if_null
(
target
,
self
.
pos
)))
code
.
error_goto_if_null
(
target
,
self
.
pos
)))
code
.
put_gotref
(
target
)
code
.
put_gotref
(
target
)
elif
self
.
type
.
is_ctuple
:
elif
self
.
type
.
is_ctuple
:
# NOTE
for
i
,
arg
in
enumerate
(
self
.
args
):
for
i
,
arg
in
enumerate
(
self
.
args
):
code
.
putln
(
"%s.f%s = %s;"
%
(
code
.
putln
(
"%s.f%s = %s;"
%
(
target
,
i
,
arg
.
result
()))
target
,
i
,
arg
.
result
()))
...
...
Cython/Compiler/Pipeline.py
View file @
4d2a3233
...
@@ -213,7 +213,7 @@ def create_pipeline(context, mode, exclude_classes=()):
...
@@ -213,7 +213,7 @@ def create_pipeline(context, mode, exclude_classes=()):
#PrintTree(),
#PrintTree(),
AnalyseExpressionsTransform
(
context
),
AnalyseExpressionsTransform
(
context
),
#
PrintTree(),
PrintTree
(),
FindInvalidUseOfFusedTypes
(
context
),
FindInvalidUseOfFusedTypes
(
context
),
ExpandInplaceOperators
(
context
),
ExpandInplaceOperators
(
context
),
...
...
Cython/Compiler/PyrexTypes.py
View file @
4d2a3233
...
@@ -3579,6 +3579,25 @@ class CppClassType(CType):
...
@@ -3579,6 +3579,25 @@ class CppClassType(CType):
return
True
return
True
return
False
return
False
# FIXME wrong place: for coercion not only type is needed - but note (e.g.
# actual variable name)
def
coerce_to
(
self
,
dst_type
,
env
):
if
self
.
cname
==
"std::pair"
and
dst_type
.
is_ctuple
:
node
=
self
.
_coerce_pair_to_ctuple
(
dst_type
,
env
)
if
node
is
not
None
:
return
node
return
super
(
CppClassType
,
self
).
coerce_to
(
dst_type
,
env
)
# std::pair[X,Y] -> ctuple(X,Y)
def
_coerce_pair_to_ctuple
(
self
,
dst_type
,
env
):
# -> node | None
if
not
(
len
(
self
.
templates
)
==
len
(
dst_type
.
components
)
==
2
):
return
None
for
(
c_src
,
c_dst
)
in
zip
(
self
.
templates
,
dst_type
.
components
):
if
not
c_src
.
same_as
(
c_dst
):
return
None
# can be converted
def
create_from_py_utility_code
(
self
,
env
):
def
create_from_py_utility_code
(
self
,
env
):
if
self
.
from_py_function
is
not
None
:
if
self
.
from_py_function
is
not
None
:
return
True
return
True
...
@@ -4062,6 +4081,8 @@ class CTupleType(CType):
...
@@ -4062,6 +4081,8 @@ class CTupleType(CType):
env
.
use_utility_code
(
self
.
_convert_from_py_code
)
env
.
use_utility_code
(
self
.
_convert_from_py_code
)
return
True
return
True
# XXX kill
"""
def assignable_from_resolved_type(self, src_type):
def assignable_from_resolved_type(self, src_type):
# (X,Y) can be assigned from std::pair[X,Y]
# (X,Y) can be assigned from std::pair[X,Y]
if src_type.is_cpp_class and src_type.cname == "std::pair":
if src_type.is_cpp_class and src_type.cname == "std::pair":
...
@@ -4070,21 +4091,11 @@ class CTupleType(CType):
...
@@ -4070,21 +4091,11 @@ class CTupleType(CType):
for (c_dst, c_src) in zip(self.components, src_type.templates):
for (c_dst, c_src) in zip(self.components, src_type.templates):
if not c_dst.same_as(c_src):
if not c_dst.same_as(c_src):
return False
return False
return
True
#return True
return False
"""
print
#from Cython.Compiler.Pipeline import dumptree
#dumptree(src_type)
print src_type
print src_type.name
print src_type.cname
print src_type.templates
print
return 1 # XXX check types are the same
"""
return super(CTupleType, self).assignable_from_resolved_type(src_type)
return super(CTupleType, self).assignable_from_resolved_type(src_type)
"""
def
c_tuple_type
(
components
):
def
c_tuple_type
(
components
):
...
...
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