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
Gwenaël Samain
cython
Commits
4a45a634
Commit
4a45a634
authored
Mar 11, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make cypclass use temporaries
parent
c0c7651a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+10
-0
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+2
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
4a45a634
...
@@ -5770,6 +5770,10 @@ class SimpleCallNode(CallNode):
...
@@ -5770,6 +5770,10 @@ class SimpleCallNode(CallNode):
if
i
>
0
:
# first argument doesn't matter
if
i
>
0
:
# first argument doesn't matter
some_args_in_temps
=
True
some_args_in_temps
=
True
arg
=
arg
.
coerce_to_temp
(
env
)
arg
=
arg
.
coerce_to_temp
(
env
)
elif
arg
.
type
.
is_cyp_class
:
if
i
>
0
:
some_args_in_temps
=
True
arg
=
arg
.
coerce_to_temp
(
env
)
args
[
i
]
=
arg
args
[
i
]
=
arg
# handle additional varargs parameters
# handle additional varargs parameters
...
@@ -5837,6 +5841,8 @@ class SimpleCallNode(CallNode):
...
@@ -5837,6 +5841,8 @@ class SimpleCallNode(CallNode):
elif
self
.
type
.
is_memoryviewslice
:
elif
self
.
type
.
is_memoryviewslice
:
self
.
is_temp
=
1
self
.
is_temp
=
1
# func_type.exception_check = True
# func_type.exception_check = True
elif
self
.
type
.
is_cyp_class
:
self
.
is_temp
=
1
if
self
.
is_temp
and
self
.
type
.
is_reference
:
if
self
.
is_temp
and
self
.
type
.
is_reference
:
self
.
type
=
PyrexTypes
.
CFakeReferenceType
(
self
.
type
.
ref_base_type
)
self
.
type
=
PyrexTypes
.
CFakeReferenceType
(
self
.
type
.
ref_base_type
)
...
@@ -6204,6 +6210,10 @@ class InlinedDefNodeCallNode(CallNode):
...
@@ -6204,6 +6210,10 @@ class InlinedDefNodeCallNode(CallNode):
if
i
>
0
:
# first argument doesn't matter
if
i
>
0
:
# first argument doesn't matter
some_args_in_temps
=
True
some_args_in_temps
=
True
arg
=
arg
.
coerce_to_temp
(
env
)
arg
=
arg
.
coerce_to_temp
(
env
)
elif
arg
.
type
.
is_cyp_class
:
if
i
>
0
:
# first argument doesn't matter
some_args_in_temps
=
True
arg
=
arg
.
coerce_to_temp
(
env
)
self
.
args
[
i
]
=
arg
self
.
args
[
i
]
=
arg
if
some_args_in_temps
:
if
some_args_in_temps
:
...
...
Cython/Compiler/Nodes.py
View file @
4a45a634
...
@@ -5491,7 +5491,7 @@ class SingleAssignmentNode(AssignmentNode):
...
@@ -5491,7 +5491,7 @@ class SingleAssignmentNode(AssignmentNode):
if
use_temp
or
rhs
.
is_attribute
or
(
if
use_temp
or
rhs
.
is_attribute
or
(
not
rhs
.
is_name
and
not
rhs
.
is_literal
and
not
rhs
.
is_name
and
not
rhs
.
is_literal
and
rhs
.
type
.
is_pyobject
):
(
rhs
.
type
.
is_pyobject
or
rhs
.
type
.
is_cyp_class
)
):
# things like (cdef) attribute access are not safe (traverses pointers)
# things like (cdef) attribute access are not safe (traverses pointers)
rhs
=
rhs
.
coerce_to_temp
(
env
)
rhs
=
rhs
.
coerce_to_temp
(
env
)
elif
rhs
.
type
.
is_pyobject
:
elif
rhs
.
type
.
is_pyobject
:
...
@@ -5699,7 +5699,7 @@ class CascadedAssignmentNode(AssignmentNode):
...
@@ -5699,7 +5699,7 @@ class CascadedAssignmentNode(AssignmentNode):
rhs
=
rhs
.
coerce_to
(
lhs_types
.
pop
(),
env
)
rhs
=
rhs
.
coerce_to
(
lhs_types
.
pop
(),
env
)
if
not
rhs
.
is_name
and
not
rhs
.
is_literal
and
(
if
not
rhs
.
is_name
and
not
rhs
.
is_literal
and
(
use_temp
or
rhs
.
is_attribute
or
rhs
.
type
.
is_pyobject
):
use_temp
or
rhs
.
is_attribute
or
rhs
.
type
.
is_pyobject
or
rhs
.
type
.
is_cyp_class
):
rhs
=
rhs
.
coerce_to_temp
(
env
)
rhs
=
rhs
.
coerce_to_temp
(
env
)
else
:
else
:
rhs
=
rhs
.
coerce_to_simple
(
env
)
rhs
=
rhs
.
coerce_to_simple
(
env
)
...
...
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