summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-11-20 16:40:44 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-11-20 16:40:44 (GMT)
commite516265bbc75e4bb7fc2ab6eaeb7ad3aef86a938 (patch)
tree0436a95d2a4ca7b01c238eb6df780798388321df /Lib/inspect.py
parent6bb9989ae38cd2610e661d6e8899ef58dd9562e3 (diff)
downloadcpython-e516265bbc75e4bb7fc2ab6eaeb7ad3aef86a938.zip
cpython-e516265bbc75e4bb7fc2ab6eaeb7ad3aef86a938.tar.gz
cpython-e516265bbc75e4bb7fc2ab6eaeb7ad3aef86a938.tar.bz2
Issue 9732: fetch the method resolution order from the type metaclass directly in getattr_static
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 97e99aa..2f05829 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -1060,6 +1060,9 @@ def trace(context=1):
_sentinel = object()
+def _static_getmro(klass):
+ return type.__dict__['__mro__'].__get__(klass)
+
def _check_instance(obj, attr):
instance_dict = {}
try:
@@ -1070,7 +1073,7 @@ def _check_instance(obj, attr):
def _check_class(klass, attr):
- for entry in getmro(klass):
+ for entry in _static_getmro(klass):
try:
return entry.__dict__[attr]
except KeyError:
@@ -1110,7 +1113,7 @@ def getattr_static(obj, attr, default=_sentinel):
if obj is klass:
# for types we check the metaclass too
- for entry in getmro(type(klass)):
+ for entry in _static_getmro(type(klass)):
try:
return entry.__dict__[attr]
except KeyError: