Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
85287cba
Commit
85287cba
authored
Mar 26, 2015
by
Marius Wachtler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix next() for reverse iter, it has to call into the reverse iter hasnext
parent
97d43471
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
src/runtime/iterobject.cpp
src/runtime/iterobject.cpp
+7
-1
test/tests/itertools_test.py
test/tests/itertools_test.py
+2
-0
test/tests/reversed.py
test/tests/reversed.py
+7
-0
No files found.
src/runtime/iterobject.cpp
View file @
85287cba
...
...
@@ -91,7 +91,13 @@ Box* seqiterNext(Box* s) {
BoxedSeqIter
*
self
=
static_cast
<
BoxedSeqIter
*>
(
s
);
if
(
!
self
->
next
)
{
Box
*
hasnext
=
seqiterHasnext
(
s
);
Box
*
hasnext
=
NULL
;
if
(
s
->
cls
==
seqiter_cls
)
hasnext
=
seqiterHasnext
(
s
);
else
if
(
s
->
cls
==
seqreviter_cls
)
hasnext
=
seqreviterHasnext
(
s
);
else
RELEASE_ASSERT
(
0
,
""
);
if
(
hasnext
==
False
)
raiseExcHelper
(
StopIteration
,
""
);
}
...
...
test/tests/itertools_test.py
View file @
85287cba
...
...
@@ -12,3 +12,5 @@ for i in xrange(10):
for
it
in
its
:
print
it
.
next
(),
print
print
list
(
itertools
.
dropwhile
(
lambda
x
:
x
==
0
,
reversed
((
1
,
2
,
3
))))
test/tests/reversed.py
View file @
85287cba
...
...
@@ -20,3 +20,10 @@ print list(reversed(RevIterTest()))
# xrange and list have __reversed__ methods
print
list
(
xrange
(
0
,
9
).
__reversed__
())
print
list
([
1
,
2
,
3
,
4
,
5
,
6
].
__reversed__
())
r
=
reversed
((
1
,
2
,
3
))
try
:
while
True
:
print
r
.
next
(),
except
StopIteration
:
print
""
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