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
6c486666
Commit
6c486666
authored
May 14, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comments
parent
541d268c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+4
-5
No files found.
Cython/Compiler/Optimize.py
View file @
6c486666
...
@@ -147,7 +147,7 @@ class IterationTransform(Visitor.VisitorTransform):
...
@@ -147,7 +147,7 @@ class IterationTransform(Visitor.VisitorTransform):
if
iterator
.
type
is
Builtin
.
dict_type
:
if
iterator
.
type
is
Builtin
.
dict_type
:
# like iterating over dict.keys()
# like iterating over dict.keys()
if
reversed
:
if
reversed
:
#
(reversed) dict iteration uses arbitrary order
#
CPython raises an error here: not a sequence
return
node
return
node
return
self
.
_transform_dict_iteration
(
return
self
.
_transform_dict_iteration
(
node
,
dict_obj
=
iterator
,
keys
=
True
,
values
=
False
)
node
,
dict_obj
=
iterator
,
keys
=
True
,
values
=
False
)
...
@@ -167,7 +167,7 @@ class IterationTransform(Visitor.VisitorTransform):
...
@@ -167,7 +167,7 @@ class IterationTransform(Visitor.VisitorTransform):
if
isinstance
(
function
,
ExprNodes
.
AttributeNode
)
and
\
if
isinstance
(
function
,
ExprNodes
.
AttributeNode
)
and
\
function
.
obj
.
type
==
Builtin
.
dict_type
:
function
.
obj
.
type
==
Builtin
.
dict_type
:
if
reversed
:
if
reversed
:
#
(reversed) dict iteration uses arbitrary order
#
CPython raises an error here: not a sequence
return
node
return
node
dict_obj
=
function
.
obj
dict_obj
=
function
.
obj
method
=
function
.
attribute
method
=
function
.
attribute
...
@@ -190,13 +190,12 @@ class IterationTransform(Visitor.VisitorTransform):
...
@@ -190,13 +190,12 @@ class IterationTransform(Visitor.VisitorTransform):
function
.
entry
and
function
.
entry
.
is_builtin
:
function
.
entry
and
function
.
entry
.
is_builtin
:
if
function
.
name
==
'enumerate'
:
if
function
.
name
==
'enumerate'
:
if
reversed
:
if
reversed
:
#
TODO: implement
#
CPython raises an error here: not a sequence
return
node
return
node
return
self
.
_transform_enumerate_iteration
(
node
,
iterator
)
return
self
.
_transform_enumerate_iteration
(
node
,
iterator
)
elif
function
.
name
==
'reversed'
:
elif
function
.
name
==
'reversed'
:
if
reversed
:
if
reversed
:
# it is not safe to short-cut here due to evaluation rules,
# CPython raises an error here: not a sequence
# but this case is unlikely enough to just ignore it
return
node
return
node
return
self
.
_transform_reversed_iteration
(
node
,
iterator
)
return
self
.
_transform_reversed_iteration
(
node
,
iterator
)
...
...
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