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
3f7d608e
Commit
3f7d608e
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
239e6850
Changes
1
Hide 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 @
3f7d608e
...
@@ -11458,12 +11458,10 @@ class BinopNode(ExprNode):
...
@@ -11458,12 +11458,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
:
...
@@ -11484,9 +11482,29 @@ class BinopNode(ExprNode):
...
@@ -11484,9 +11482,29 @@ 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
+
"="
...
...
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