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
3d6647f0
Commit
3d6647f0
authored
Feb 24, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More temp arg assignment avoidance.
parent
1f3995a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-5
No files found.
Cython/Compiler/ExprNodes.py
View file @
3d6647f0
...
...
@@ -368,7 +368,7 @@ class ExprNode(Node):
def
nonlocally_immutable
(
self
):
# Returns whether this variable is a safe reference, i.e.
# can't be modified as part of globals or closures.
return
self
.
is_temp
return
self
.
is_temp
or
self
.
type
.
is_array
or
self
.
type
.
is_cfunction
# --------------- Type Analysis ------------------
...
...
@@ -1477,6 +1477,8 @@ class NameNode(AtomicExprNode):
return
1
def
nonlocally_immutable
(
self
):
if
ExprNode
.
nonlocally_immutable
(
self
):
return
True
entry
=
self
.
entry
return
entry
and
(
entry
.
is_local
or
entry
.
is_arg
)
and
not
entry
.
in_closure
...
...
@@ -3038,10 +3040,8 @@ class SimpleCallNode(CallNode):
if
i
==
0
and
self
.
self
is
not
None
:
continue
# self is ok
arg
=
self
.
args
[
i
]
if
arg
.
is_name
and
arg
.
entry
and
(
(
arg
.
entry
.
is_local
and
not
arg
.
entry
.
in_closure
)
or
arg
.
entry
.
type
.
is_cfunction
):
# local variables and C functions are safe
if
arg
.
nonlocally_immutable
():
# locals, C functions, unassignable types are safe.
pass
elif
arg
.
type
.
is_cpp_class
:
# Assignment has side effects, avoid.
...
...
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