Skip to content

WPS457 false positive with while in try / except #3603

@sobolevn

Description

@sobolevn

I have the following code:

def factory() -> Iterator[bytes]:
    try:
        while True:  # noqa: WPS457
            yield async_to_sync(async_anext)(iterator)
    except StopAsyncIteration:
        pass

It should not raise WPS457, because while is in try / except.
It can clearly raise and we handle the error. So, it is not infinite.

PRs are welcome! 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueEntrypoint to the projecthelp wantedExtra attention is neededlevel:starterGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions