this is part of a function that uses a stack to behave similarly to a
recursive function.
here's where the stack ('indices = [') is initialised:
(Pdb) list 38
33 # index stream offset index offset region size
34 indices = [(self.tail, 0, 0, total_size)]
35 while len(indices):
36 index, index_offset, index_start, index_size = indices[-1]
37 index_offset_in_stream = index_offset - index_start
38 for type, index, index_substart, index_subsize, *_ in index:
39 if index_offset_in_stream ==
stream_output_offset and index_subsize > 0:
40 if type == 1:
41 for ditem in index['ditem']:
42 assert ditem not in visited
43 visited.add(ditem)
in me somehow, I know there is a good chance there is a bad bug
somewhere in those initialisation lines. it's hard for me to consider
it, look at it, and verify the various parts are functionally correct,
at the same time. pretty hard. so instead i generally use the debugger
to backtrack, popping breakpoints and tracepoints around. this lets me
do it more in a rote manner.