From 687ae00460da9cac04eb1ba8f6f5ab4db25fbfc2 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 15 Oct 2001 22:03:32 +0000 Subject: Get rid of __defined__ and tp_defined -- there's no need to distinguish __dict__ and __defined__ any more. In the C structure, tp_cache takes its place -- but this hasn't been implemented yet. --- Lib/inspect.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'Lib/inspect.py') diff --git a/Lib/inspect.py b/Lib/inspect.py index c5c6709798..e55edcab28 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -200,24 +200,9 @@ def classify_class_attrs(cls): obj = getattr(cls, name) # Figure out where it was defined. - # A complication: static classes in 2.2 copy dict entries from - # bases into derived classes, so it's not enough just to look for - # "the first" class with the name in its dict. OTOH: - # 1. Some-- but not all --methods in 2.2 come with an __objclass__ - # attr that answers the question directly. - # 2. Some-- but not all --classes in 2.2 have a __defined__ dict - # saying which names were defined by the class. homecls = getattr(obj, "__objclass__", None) if homecls is None: - # Try __defined__. - for base in mro: - if hasattr(base, "__defined__"): - if name in base.__defined__: - homecls = base - break - if homecls is None: - # Last chance (and first chance for classic classes): search - # the dicts. + # search the dicts. for base in mro: if name in base.__dict__: homecls = base -- cgit v1.2.1