MCPcopy Index your code
hub / github.com/python/cpython / _allow_reckless_class_checks

Function _allow_reckless_class_checks

Lib/typing.py:1942–1950  ·  view source on GitHub ↗

Allow instance and class checks for special stdlib modules. The abc and functools modules indiscriminately call isinstance() and issubclass() on the whole MRO of a user class, which may contain protocols.

(depth=2)

Source from the content-addressed store, hash-verified

1940 return None
1941
1942def _allow_reckless_class_checks(depth=2):
1943 """Allow instance and class checks for special stdlib modules.
1944
1945 The abc and functools modules indiscriminately call isinstance() and
1946 issubclass() on the whole MRO of a user class, which may contain protocols.
1947 """
1948 # gh-136047: When `_abc` module is not available, `_py_abc` is required to
1949 # allow `_py_abc.ABCMeta` fallback.
1950 return _caller(depth) in {'abc', '_py_abc', 'functools', None}
1951
1952
1953_PROTO_ALLOWLIST = {

Callers 2

__subclasscheck__Method · 0.85
__instancecheck__Method · 0.85

Calls 1

_callerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…