Skip to content

Commit 9249fce

Browse files
committed
SL-18330: Unify Py 2 and 3 on 'range()' not 'xrange()'
1 parent e53c051 commit 9249fce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llsd/serde_binary.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010

1111
try:
12-
# Python 2
13-
xrange
12+
# Python 2: make 'range()' lazy like Python 3
13+
range = xrange
1414
except NameError:
15-
# Python 3
16-
xrange = range
15+
# Python 3: 'range()' is already lazy
16+
pass
1717

1818

1919
class LLSDBinaryParser(LLSDBaseParser):
@@ -116,7 +116,7 @@ def _parse_array(self):
116116
"Parse a single llsd array"
117117
rv = []
118118
size = struct.unpack("!i", self._getc(4))[0]
119-
for count in xrange(size):
119+
for count in range(size):
120120
rv.append(self._parse())
121121
if self._getc() != b']':
122122
self._error("invalid array close token")

0 commit comments

Comments
 (0)