https://github.com/python/cpython/commit/887e5c8646dfc6dd3d64b482c5310a414ac9162b
commit: 887e5c8646dfc6dd3d64b482c5310a414ac9162b
branch: main
author: Jeong, YunWon <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2025-07-05T14:24:33Z
summary:
gh-136047: Allow typing._allow_reckless_class_checks to check `_py_abc`
(#136115)
files:
A Misc/NEWS.d/next/Library/2025-07-05-06-59-46.gh-issue-136047.qWvycf.rst
M Lib/typing.py
diff --git a/Lib/typing.py b/Lib/typing.py
index 4ebf0eb92f589f..27105838a0a064 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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 = {
diff --git
a/Misc/NEWS.d/next/Library/2025-07-05-06-59-46.gh-issue-136047.qWvycf.rst
b/Misc/NEWS.d/next/Library/2025-07-05-06-59-46.gh-issue-136047.qWvycf.rst
new file mode 100644
index 00000000000000..1a381860914bc3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-07-05-06-59-46.gh-issue-136047.qWvycf.rst
@@ -0,0 +1,2 @@
+Fix issues with :mod:`typing` when the C implementation of :mod:`abc` is not
+available.
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]