mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue 23898: Fix inspect.classify_class_attrs() to work with __eq__
Patch by Mike Bayer.
This commit is contained in:
commit
095fb84fc2
3 changed files with 21 additions and 3 deletions
|
@ -395,7 +395,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:
|
||||
|
@ -403,7 +403,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
|
||||
|
@ -417,7 +417,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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue