From: Jeong, YunWon <69878+youknowone@users.noreply.github.com> Date: Sat, 5 Jul 2025 14:24:33 +0000 (+0900) Subject: gh-136047: Allow typing._allow_reckless_class_checks to check `_py_abc` (#136115) X-Git-Tag: v3.15.0a1~1085 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=887e5c8646dfc6dd3d64b482c5310a414ac9162b;p=thirdparty%2FPython%2Fcpython.git gh-136047: Allow typing._allow_reckless_class_checks to check `_py_abc` (#136115) --- diff --git a/Lib/typing.py b/Lib/typing.py index 4ebf0eb92f58..27105838a0a0 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 000000000000..1a381860914b --- /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.