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
Boxiang Sun
cython
Commits
b7a13a42
Commit
b7a13a42
authored
Aug 15, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '0.23.x'
parents
e36804d0
00bd02fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+8
-3
tests/run/dict.pyx
tests/run/dict.pyx
+10
-0
No files found.
Cython/Compiler/Optimize.py
View file @
b7a13a42
...
...
@@ -4201,15 +4201,20 @@ class FinalOptimizePhase(Visitor.CythonTransform, Visitor.NodeRefCleanupMixin):
may_be_a_method
=
True
if
function
.
type
is
Builtin
.
type_type
:
may_be_a_method
=
False
elif
function
.
is_attribute
:
if
function
.
entry
.
type
.
is_cfunction
:
# optimised builtin method
may_be_a_method
=
False
elif
function
.
is_name
:
if
function
.
entry
.
is_builtin
:
entry
=
function
.
entry
if
entry
.
is_builtin
or
entry
.
type
.
is_cfunction
:
may_be_a_method
=
False
elif
function
.
entry
.
cf_assignments
:
elif
entry
.
cf_assignments
:
# local functions/classes are definitely not methods
non_method_nodes
=
(
ExprNodes
.
PyCFunctionNode
,
ExprNodes
.
ClassNode
,
ExprNodes
.
Py3ClassNode
)
may_be_a_method
=
any
(
assignment
.
rhs
and
not
isinstance
(
assignment
.
rhs
,
non_method_nodes
)
for
assignment
in
function
.
entry
.
cf_assignments
)
for
assignment
in
entry
.
cf_assignments
)
if
may_be_a_method
:
node
=
self
.
replace
(
node
,
ExprNodes
.
PyMethodCallNode
.
from_node
(
node
,
function
=
function
,
arg_tuple
=
node
.
arg_tuple
,
type
=
node
.
type
))
...
...
tests/run/dict.pyx
View file @
b7a13a42
...
...
@@ -83,6 +83,16 @@ def dict_call_kwargs():
return
d
def
items_of_dict_call
():
"""
>>> items_of_dict_call()
[('answer1', 42), ('answer2', 42), ('parrot1', u'resting'), ('parrot2', u'resting')]
"""
kwargs
=
dict
(
parrot1
=
u"resting"
,
answer1
=
42
)
items
=
dict
(
kwargs
.
items
(),
parrot2
=
u"resting"
,
answer2
=
42
,
**
kwargs
).
items
()
return
sorted
(
items
)
def
item_creation_sideeffect
(
L
,
sideeffect
,
unhashable
):
"""
>>> def sideeffect(x):
...
...
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