JSONLogIterator uses generators improperly
Closed this issue · 2 comments
There's a convenient JSON logging format built into swift console, however the libsbp python code to decode those logs has a subtle bug, which is already sortof notated in the code.
The key here is a slight misuse of the Python iterator model. If the class wants to act as an iterator itself, it could try to continue following the current behavior of returning self
in __iter__
and properly re-implement the __next__
method; however I believe simply changing the __next__
method of JSONLogIterator to be called __iter__
would cause the returned generator to fill in as an iterator, which should work fine in most cases.
Old issue, but I think we've resolved this with the introduction of the conventional
parameter for the log iterator. To get standard Python iterator behavior construct the JSONLogIterator with conventional=True
. E.g. JSONLogIterator(file_handle, conventional=True)
Please re-open if needed