We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0bf6e31 commit e3cf5faCopy full SHA for e3cf5fa
1 file changed
Lib/inspect.py
@@ -1740,6 +1740,9 @@ def _shadowed_dict(klass):
1740
# destroyed, and the dynamically created classes happen to be the only
1741
# objects that hold strong references to other objects that take up a
1742
# significant amount of memory.
1743
+ # Fast path: `type` is the dominant caller; result is always _sentinel.
1744
+ if klass is type:
1745
+ return _sentinel
1746
return _shadowed_dict_from_weakref_mro_tuple(
1747
*[make_weakref(entry) for entry in _static_getmro(klass)]
1748
)
0 commit comments