File tree 2 files changed +5
-4
lines changed
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -1772,9 +1772,9 @@ def trace(context=1):
1772
1772
# ------------------------------------------------ static version of getattr
1773
1773
1774
1774
_sentinel = object ()
1775
+ _static_getmro = type .__dict__ ['__mro__' ].__get__
1776
+ _get_dunder_dict_of_class = type .__dict__ ["__dict__" ].__get__
1775
1777
1776
- def _static_getmro (klass ):
1777
- return type .__dict__ ['__mro__' ].__get__ (klass )
1778
1778
1779
1779
def _check_instance (obj , attr ):
1780
1780
instance_dict = {}
@@ -1802,10 +1802,9 @@ def _is_type(obj):
1802
1802
return True
1803
1803
1804
1804
def _shadowed_dict (klass ):
1805
- dict_attr = type .__dict__ ["__dict__" ]
1806
1805
for entry in _static_getmro (klass ):
1807
1806
try :
1808
- class_dict = dict_attr . __get__ (entry )["__dict__" ]
1807
+ class_dict = _get_dunder_dict_of_class (entry )["__dict__" ]
1809
1808
except KeyError :
1810
1809
pass
1811
1810
else :
Original file line number Diff line number Diff line change
1
+ Improve performance of :func: `inspect.getattr_static `. Patch by Alex
2
+ Waygood.
You can’t perform that action at this time.
0 commit comments