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

Function _lookup_special

Lib/contextlib.py:472–480  ·  view source on GitHub ↗
(obj, name, default)

Source from the content-addressed store, hash-verified

470
471
472def _lookup_special(obj, name, default):
473 # Follow the standard lookup behaviour for special methods.
474 from inspect import getattr_static, _descriptor_get
475 cls = type(obj)
476 try:
477 descr = getattr_static(cls, name)
478 except AttributeError:
479 return default
480 return _descriptor_get(descr, obj)
481
482
483_sentinel = ['SENTINEL']

Callers 4

pushMethod · 0.85
enter_contextMethod · 0.85
enter_async_contextMethod · 0.85
push_async_exitMethod · 0.85

Calls 2

getattr_staticFunction · 0.90
_descriptor_getFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…