[Python-checkins] CVS: python/dist/src/Lib inspect.py,1.25,1.26

Guido van Rossum gvanrossum@users.sourceforge.net
2001年10月15日 15:03:34 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv23185/Lib
Modified Files:
	inspect.py 
Log Message:
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.
Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** inspect.py	2001年09月23日 02:00:29	1.25
--- inspect.py	2001年10月15日 22:03:31	1.26
***************
*** 201,222 ****
 
 # 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.
 for base in mro:
 if name in base.__dict__:
--- 201,207 ----
 
 # Figure out where it was defined.
 homecls = getattr(obj, "__objclass__", None)
 if homecls is None:
! # search the dicts.
 for base in mro:
 if name in base.__dict__:

AltStyle によって変換されたページ (->オリジナル) /