gh-136047: Allow typing._allow_reckless_class_checks to check _py_abc (#136115)

This commit is contained in:
Jeong, YunWon 2025-07-05 23:24:33 +09:00 committed by GitHub
parent 5b56daa9d7
commit 887e5c8646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 1 deletions

View file

@ -1866,7 +1866,9 @@ def _allow_reckless_class_checks(depth=2):
The abc and functools modules indiscriminately call isinstance() and
issubclass() on the whole MRO of a user class, which may contain protocols.
"""
return _caller(depth) in {'abc', 'functools', None}
# gh-136047: When `_abc` module is not available, `_py_abc` is required to
# allow `_py_abc.ABCMeta` fallback.
return _caller(depth) in {'abc', '_py_abc', 'functools', None}
_PROTO_ALLOWLIST = {

View file

@ -0,0 +1,2 @@
Fix issues with :mod:`typing` when the C implementation of :mod:`abc` is not
available.