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
b8d4929e
Commit
b8d4929e
authored
Feb 14, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid some unnecessary round trips when creating immutable objects
parent
edb8f353
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+8
-6
No files found.
Cython/Compiler/Optimize.py
View file @
b8d4929e
...
...
@@ -1972,13 +1972,13 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
"""
if
len
(
pos_args
)
!=
1
:
return
node
list_arg
=
pos_args
[
0
]
if
list_arg
.
type
is
not
Builtin
.
list_type
:
arg
=
pos_args
[
0
]
if
arg
.
type
is
Builtin
.
tuple_type
and
not
arg
.
may_be_none
():
return
arg
if
arg
.
type
is
not
Builtin
.
list_type
:
return
node
if
not
isinstance
(
list_arg
,
(
ExprNodes
.
ComprehensionNode
,
ExprNodes
.
ListNode
)):
pos_args
[
0
]
=
list_arg
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
pos_args
[
0
]
=
arg
.
as_none_safe_node
(
"'NoneType' object is not iterable"
)
return
ExprNodes
.
PythonCapiCallNode
(
node
.
pos
,
"PyList_AsTuple"
,
self
.
PyList_AsTuple_func_type
,
...
...
@@ -2031,6 +2031,8 @@ class OptimizeBuiltinCalls(Visitor.MethodDispatcherTransform):
pos_args
=
[
ExprNodes
.
NullNode
(
node
.
pos
)]
elif
len
(
pos_args
)
>
1
:
return
node
elif
pos_args
[
0
].
type
is
Builtin
.
frozenset_type
and
not
pos_args
[
0
].
may_be_none
():
return
pos_args
[
0
]
# PyFrozenSet_New(it) is better than a generic Python call to frozenset(it)
return
ExprNodes
.
PythonCapiCallNode
(
node
.
pos
,
"__Pyx_PyFrozenSet_New"
,
...
...
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