ITADN

`WPS457` false positive with `while` in `try` / `except`

#3603Opensobolevn 创建于 2026-02-22
bughelp wantedlevel:startergood first issue
S
sobolevncommented
I have the following code: ```python 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! 👍
1 条评论