Skip to content

Commit 887e5c8

Browse files
authored
gh-136047: Allow typing._allow_reckless_class_checks to check _py_abc (#136115)
1 parent 5b56daa commit 887e5c8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Lib/typing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,9 @@ def _allow_reckless_class_checks(depth=2):
18661866
The abc and functools modules indiscriminately call isinstance() and
18671867
issubclass() on the whole MRO of a user class, which may contain protocols.
18681868
"""
1869-
return _caller(depth) in {'abc', 'functools', None}
1869+
# gh-136047: When `_abc` module is not available, `_py_abc` is required to
1870+
# allow `_py_abc.ABCMeta` fallback.
1871+
return _caller(depth) in {'abc', '_py_abc', 'functools', None}
18701872

18711873

18721874
_PROTO_ALLOWLIST = {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix issues with :mod:`typing` when the C implementation of :mod:`abc` is not
2+
available.

0 commit comments

Comments
 (0)