Derived from the pyupgrade linter.
Fix is always available.
This rule is unstable and in preview. The
--preview flag is required for use.
What it does#
Checks for uses of exceptions that alias
Why is this bad?#
TimeoutError is the builtin error type used for exceptions when a system
function timed out at the system level.
In Python 3.10,
socket.timeout was aliased to
TimeoutError. In Python
asyncio.TimeoutError was aliased to
These aliases remain in place for compatibility with older versions of Python, but may be removed in future versions.
TimeoutError directly, as it is more idiomatic and future-proof.