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

Function _caller

Lib/typing.py:1931–1940  ·  view source on GitHub ↗
(depth=1, default='__main__')

Source from the content-addressed store, hash-verified

1929
1930
1931def _caller(depth=1, default='__main__'):
1932 try:
1933 return sys._getframemodulename(depth + 1) or default
1934 except AttributeError: # For platforms without _getframemodulename()
1935 pass
1936 try:
1937 return sys._getframe(depth + 1).f_globals.get('__name__', default)
1938 except (AttributeError, ValueError): # For platforms without _getframe()
1939 pass
1940 return None
1941
1942def _allow_reckless_class_checks(depth=2):
1943 """Allow instance and class checks for special stdlib modules.

Callers 4

NamedTupleFunction · 0.85
TypedDictFunction · 0.85
__init__Method · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…