ruff/crates/ruff_linter
Andrew Gallant a7dbe9d670
refine pyupgrade's TimeoutErrorAlias lint (UP041) to remove false positives (#8587)
Previously, this lint had its alias detection logic a little
backwards. That is, for Python 3.11+, it would *only* detect
asyncio.TimeoutError as an alias, but it should have also detected
socket.timeout as an alias. And in Python <3.11, it would falsely
detect asyncio.TimeoutError as an alias where it should have only
detected socket.timeout as an alias.

We fix it so that both asyncio.TimeoutError and socket.timeout are
detected as aliases in Python 3.11+, and only socket.timeout is
detected as an alias in Python 3.10.

Fixes #8565

## Test Plan

I tested this by updating the existing snapshot test which had
erroneously
asserted that socket.timeout should not be replaced with TimeoutError in
Python
3.11+. I also added a new regression test that targets Python 3.10 and
ensures
that the suggestion to replace asyncio.TimeoutError with TimeoutError
does not
occur.
2023-11-10 10:15:33 -05:00
..
resources/test Consider the new f-string tokens for flake8-commas (#8582) 2023-11-10 09:49:14 +05:30
src refine pyupgrade's TimeoutErrorAlias lint (UP041) to remove false positives (#8587) 2023-11-10 10:15:33 -05:00
Cargo.toml Prepare release 0.1.5 (#8570) 2023-11-08 16:00:57 -06:00