Skip to content

JSONLogIterator uses generators improperly #716

@bk-mtg

Description

@bk-mtg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions