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
89ed75ac
Commit
89ed75ac
authored
Jun 03, 2020
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Analyse mixed C++ / Python operations prioritarily as a C++ operation
parent
58ee6fc4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+23
-5
No files found.
Cython/Compiler/ExprNodes.py
View file @
89ed75ac
...
@@ -11412,12 +11412,10 @@ class BinopNode(ExprNode):
...
@@ -11412,12 +11412,10 @@ class BinopNode(ExprNode):
self
.
operand2
.
type
,
env
)
self
.
operand2
.
type
,
env
)
assert
self
.
type
.
is_pythran_expr
assert
self
.
type
.
is_pythran_expr
self
.
is_temp
=
1
self
.
is_temp
=
1
elif
self
.
is_cpp_py_operation
():
self
.
analyse_cpp_py_operation
(
env
)
elif
self
.
is_py_operation
():
elif
self
.
is_py_operation
():
self
.
coerce_operands_to_pyobjects
(
env
)
self
.
analyse_py_operation
(
env
)
self
.
type
=
self
.
result_type
(
self
.
operand1
.
type
,
self
.
operand2
.
type
,
env
)
assert
self
.
type
.
is_pyobject
self
.
is_temp
=
1
elif
self
.
is_cpp_operation
():
elif
self
.
is_cpp_operation
():
self
.
analyse_cpp_operation
(
env
)
self
.
analyse_cpp_operation
(
env
)
else
:
else
:
...
@@ -11438,10 +11436,30 @@ class BinopNode(ExprNode):
...
@@ -11438,10 +11436,30 @@ class BinopNode(ExprNode):
(
is_pythran_supported_operation_type
(
type1
)
and
is_pythran_supported_operation_type
(
type2
))
and
\
(
is_pythran_supported_operation_type
(
type1
)
and
is_pythran_supported_operation_type
(
type2
))
and
\
(
is_pythran_expr
(
type1
)
or
is_pythran_expr
(
type2
))
(
is_pythran_expr
(
type1
)
or
is_pythran_expr
(
type2
))
def
is_cpp_py_operation
(
self
):
type1
=
self
.
operand1
.
type
type2
=
self
.
operand2
.
type
return
type1
.
is_cpp_class
and
type2
.
is_pyobject
def
is_cpp_operation
(
self
):
def
is_cpp_operation
(
self
):
return
(
self
.
operand1
.
type
.
is_cpp_class
return
(
self
.
operand1
.
type
.
is_cpp_class
or
self
.
operand2
.
type
.
is_cpp_class
)
or
self
.
operand2
.
type
.
is_cpp_class
)
def
analyse_cpp_py_operation
(
self
,
env
):
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
])
if
entry
:
self
.
analyse_cpp_operation
(
env
)
else
:
self
.
analyse_py_operation
(
env
)
def
analyse_py_operation
(
self
,
env
):
self
.
coerce_operands_to_pyobjects
(
env
)
self
.
type
=
self
.
result_type
(
self
.
operand1
.
type
,
self
.
operand2
.
type
,
env
)
assert
self
.
type
.
is_pyobject
self
.
is_temp
=
1
def
analyse_cpp_operation
(
self
,
env
):
def
analyse_cpp_operation
(
self
,
env
):
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
operator
=
self
.
operator
if
not
self
.
inplace
else
self
.
operator
+
"="
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
])
entry
=
env
.
lookup_operator
(
operator
,
[
self
.
operand1
,
self
.
operand2
])
...
...
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