Skip to content

Latest commit

 

History

History
10 lines (10 loc) · 653 Bytes

2023-03-25-16-57-18.gh-issue-102433.L-7x2Q.rst

File metadata and controls

10 lines (10 loc) · 653 Bytes

:func:`isinstance` checks against :func:`runtime-checkable protocols <typing.runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:`hasattr` to lookup whether attributes exist. This means that descriptors and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated during isinstance() checks against runtime-checkable protocols. However, it may also mean that some objects which used to be considered instances of a runtime-checkable protocol may no longer be considered instances of that protocol on Python 3.12+, and vice versa. Most users are unlikely to be affected by this change. Patch by Alex Waygood.