Skip to content

Commit 801d268

Browse files
authored
Auto merge of #34689 - alexcrichton:fix-nightlies, r=alexcrichton
First attempt to fix nightlies This is just #34669 but I added some comments so it can land.
2 parents 34c9cdd + 01c4b64 commit 801d268

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/etc/gdb_rust_pretty_printing.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010

1111
import gdb
1212
import re
13+
import sys
1314
import debugger_pretty_printers_common as rustpp
1415

16+
# We want a version of `range` which doesn't allocate an intermediate list,
17+
# specifically it should use a lazy iterator. In Python 2 this was `xrange`, but
18+
# if we're running with Python 3 then we need to use `range` instead.
19+
if sys.version_info.major >= 3:
20+
xrange = range
21+
1522
#===============================================================================
1623
# GDB Pretty Printing Module for Rust
1724
#===============================================================================
@@ -215,7 +222,7 @@ def children(self):
215222
assert data_ptr.type.get_dwarf_type_kind() == rustpp.DWARF_TYPE_CODE_PTR
216223
raw_ptr = data_ptr.get_wrapped_value()
217224

218-
for index in range(0, length):
225+
for index in xrange(0, length):
219226
yield (str(index), (raw_ptr + index).dereference())
220227

221228

@@ -244,7 +251,7 @@ def to_string(self):
244251
def children(self):
245252
(length, data_ptr, cap) = rustpp.extract_length_ptr_and_cap_from_std_vec(self.__val)
246253
gdb_ptr = data_ptr.get_wrapped_value()
247-
for index in range(0, length):
254+
for index in xrange(0, length):
248255
yield (str(index), (gdb_ptr + index).dereference())
249256

250257

0 commit comments

Comments
 (0)