diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-21 19:41:57 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-05-21 19:41:57 (GMT) |
commit | bf341fb5f6016ca5c79cee01211631ab5a01c5cf (patch) | |
tree | f1f93f45f17bc2404d044996fc55fb654de09367 /Lib/inspect.py | |
parent | 0978b5cdb36ef73061e438c342b508dd38c73ce8 (diff) | |
download | cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.zip cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.tar.gz cpython-bf341fb5f6016ca5c79cee01211631ab5a01c5cf.tar.bz2 |
Issue 23898: Fix inspect.classify_class_attrs() to work with __eq__
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r-- | Lib/inspect.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py index 1641824..a91f749 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -380,7 +380,7 @@ def classify_class_attrs(cls): # first look in the classes for srch_cls in class_bases: srch_obj = getattr(srch_cls, name, None) - if srch_obj == get_obj: + if srch_obj is get_obj: last_cls = srch_cls # then check the metaclasses for srch_cls in metamro: @@ -388,7 +388,7 @@ def classify_class_attrs(cls): srch_obj = srch_cls.__getattr__(cls, name) except AttributeError: continue - if srch_obj == get_obj: + if srch_obj is get_obj: last_cls = srch_cls if last_cls is not None: homecls = last_cls @@ -402,7 +402,7 @@ def classify_class_attrs(cls): # unable to locate the attribute anywhere, most likely due to # buggy custom __dir__; discard and move on continue - obj = get_obj or dict_obj + obj = get_obj if get_obj is not None else dict_obj # Classify the object or its descriptor. if isinstance(dict_obj, staticmethod): kind = "static method" |