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
c416c7cb
Commit
c416c7cb
authored
Jun 21, 2022
by
Kenrick Everett
Committed by
GitHub
Jun 21, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bytearray iteration in 0.29.x (#4108)
By explicitly setting the result type
parent
a7d98eea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+4
-0
tests/run/bytearray_iter.py
tests/run/bytearray_iter.py
+15
-0
No files found.
Cython/Compiler/ExprNodes.py
View file @
c416c7cb
...
...
@@ -2876,6 +2876,10 @@ class NextNode(AtomicExprNode):
iterator_type
=
self
.
iterator
.
infer_type
(
env
)
if
iterator_type
.
is_ptr
or
iterator_type
.
is_array
:
return
iterator_type
.
base_type
elif
self
.
iterator
.
sequence
.
type
is
bytearray_type
:
# This is a temporary work-around to fix bytearray iteration in 0.29.x
# It has been fixed properly in master, refer to ticket: 3473
return
py_object_type
elif
iterator_type
.
is_cpp_class
:
item_type
=
env
.
lookup_operator_for_types
(
self
.
pos
,
"*"
,
[
iterator_type
]).
type
.
return_type
if
item_type
.
is_reference
:
...
...
tests/run/bytearray_iter.py
0 → 100644
View file @
c416c7cb
# mode: run
# ticket: 3473
def
test_bytearray_iteration
(
src
):
"""
>>> src = b'123'
>>> test_bytearray_iteration(src)
49
50
51
"""
data
=
bytearray
(
src
)
for
elem
in
data
:
print
(
elem
)
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