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
f1d781a6
Commit
f1d781a6
authored
Sep 03, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix char* string iteration when we actually need to coerce to a Python string for iteration
parent
f8e85bee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Cython/Compiler/Optimize.py
Cython/Compiler/Optimize.py
+9
-8
No files found.
Cython/Compiler/Optimize.py
View file @
f1d781a6
...
@@ -90,15 +90,16 @@ class IterationTransform(Visitor.VisitorTransform):
...
@@ -90,15 +90,16 @@ class IterationTransform(Visitor.VisitorTransform):
node
,
dict_obj
=
iterator
,
keys
=
True
,
values
=
False
)
node
,
dict_obj
=
iterator
,
keys
=
True
,
values
=
False
)
# C array (slice) iteration?
# C array (slice) iteration?
plain_iterator
=
iterator
if
isinstance
(
iterator
,
ExprNodes
.
CoerceToPyTypeNode
):
if
isinstance
(
iterator
,
ExprNodes
.
CoerceToPyTypeNode
):
iterator
=
iterator
.
arg
plain_
iterator
=
iterator
.
arg
if
isinstance
(
iterator
,
ExprNodes
.
SliceIndexNode
)
and
\
if
isinstance
(
plain_
iterator
,
ExprNodes
.
SliceIndexNode
)
and
\
(
iterator
.
base
.
type
.
is_array
or
iterator
.
base
.
type
.
is_ptr
):
(
plain_iterator
.
base
.
type
.
is_array
or
plain_
iterator
.
base
.
type
.
is_ptr
):
return
self
.
_transform_carray_iteration
(
node
,
iterator
)
return
self
.
_transform_carray_iteration
(
node
,
plain_
iterator
)
elif
isinstance
(
iterator
,
ExprNodes
.
IndexNode
)
and
\
elif
isinstance
(
plain_
iterator
,
ExprNodes
.
IndexNode
)
and
\
isinstance
(
iterator
.
index
,
(
ExprNodes
.
SliceNode
,
ExprNodes
.
CoerceFromPyTypeNode
))
and
\
isinstance
(
plain_
iterator
.
index
,
(
ExprNodes
.
SliceNode
,
ExprNodes
.
CoerceFromPyTypeNode
))
and
\
(
iterator
.
base
.
type
.
is_array
or
iterator
.
base
.
type
.
is_ptr
):
(
plain_iterator
.
base
.
type
.
is_array
or
plain_
iterator
.
base
.
type
.
is_ptr
):
return
self
.
_transform_carray_iteration
(
node
,
iterator
)
return
self
.
_transform_carray_iteration
(
node
,
plain_
iterator
)
elif
iterator
.
type
.
is_array
:
elif
iterator
.
type
.
is_array
:
return
self
.
_transform_carray_iteration
(
node
,
iterator
)
return
self
.
_transform_carray_iteration
(
node
,
iterator
)
elif
iterator
.
type
in
(
Builtin
.
bytes_type
,
Builtin
.
unicode_type
):
elif
iterator
.
type
in
(
Builtin
.
bytes_type
,
Builtin
.
unicode_type
):
...
...
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