let's look just around the area where the assertion is raised.
the debugger is actually paused there right now.
(Pdb) list
56 assert length > 0
57 yield index, header, stream, length
58 stream_output_offset += length
59 else:
60 print('skipping', index)
61 -> assert index_offset_in_stream < stream_output_offset
62 index_offset_in_stream += index_subsize
63 else:
64 print('popping')
65 indices.pop()
66 assert offset == total_size
index_offset_in_stream is its calculation of where in the overall
stream the current index spot is.
i expanded the index format so that it could reference data from other
streams, or other parts in its stream, for arbitrary purposes. so the
approach currently tries to retain a reference to where it is in the
particular stream it got there from.
stream_output_offset is how much of the stream it has written. the
approach to keep them separate let me reuse part of the previous
algorithm loop, getting farther before i spazzed out.