File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,11 @@ func (it *RangeIterator) M__iter__() (Object, error) {
9090// Range iterator next
9191func (it * RangeIterator ) M__next__ () (Object , error ) {
9292 r := it .Index
93- if r >= it .Stop {
93+ if it .Step >= 0 && r >= it .Stop {
94+ return nil , StopIteration
95+ }
96+
97+ if it .Step < 0 && r <= it .Stop {
9498 return nil , StopIteration
9599 }
96100 it .Index += it .Step
Original file line number Diff line number Diff line change 1+ # Copyright 2018 The go-python Authors. All rights reserved.
2+ # Use of this source code is governed by a BSD-style
3+ # license that can be found in the LICENSE file.
4+
5+ doc = "range"
6+ a = range (255 )
7+ b = [e for e in a ]
8+ assert len (b ) == 255
9+ a = range (100 , 0 , - 1 )
10+ b = [e for e in a ]
11+ assert len (b ) == 100
12+
13+ doc = "finished"
You can’t perform that action at this time.
0 commit comments