Skip to content

Commit 7b7d6e3

Browse files
committed
Remove unnecessary overflow handling.
1 parent 11ca5c8 commit 7b7d6e3

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

graalpython/lib-graalpython/timsort.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,8 @@ def gallop(self, key, a, hint, rightmost):
166166
while ofs < maxofs:
167167
if lower(a.getitem(p + ofs), key):
168168
lastofs = ofs
169-
try:
170-
ofs = ofs << 1
171-
except OverflowError:
172-
ofs = maxofs
173-
else:
174-
ofs = ofs + 1
169+
ofs = ofs << 1
170+
ofs = ofs + 1
175171
else: # key <= a[hint + ofs]
176172
break
177173

@@ -191,12 +187,8 @@ def gallop(self, key, a, hint, rightmost):
191187
else:
192188
# key <= a[hint - ofs]
193189
lastofs = ofs
194-
try:
195-
ofs = ofs << 1
196-
except OverflowError:
197-
ofs = maxofs
198-
else:
199-
ofs = ofs + 1
190+
ofs = ofs << 1
191+
ofs = ofs + 1
200192
if ofs > maxofs:
201193
ofs = maxofs
202194
# Translate back to positive offsets relative to a.

0 commit comments

Comments
 (0)