[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.67,2.68

Guido van Rossum gvanrossum@users.sourceforge.net
Fri, 21 Sep 2001 12:29:10 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv23152/Objects

Modified Files:
	typeobject.c 
Log Message:
Change the name of the __getattr__ special method for new-style
classes to __getattribute__, to make it crystal-clear that it doesn't
have the same semantics as overriding __getattr__ on classic classes.

This is a halfway checkin -- I'll proceed to add a __getattr__ hook
that works the way it works in classic classes.


Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.67
retrieving revision 2.68
diff -C2 -d -r2.67 -r2.68
*** typeobject.c	2001/09/20 21:45:26	2.67
--- typeobject.c	2001/09/21 19:29:08	2.68
***************
*** 2062,2067 ****
  
  static struct wrapperbase tab_getattr[] = {
! 	{"__getattr__", (wrapperfunc)wrap_binaryfunc,
! 	 "x.__getattr__('name') <==> x.name"},
  	{0}
  };
--- 2062,2067 ----
  
  static struct wrapperbase tab_getattr[] = {
! 	{"__getattribute__", (wrapperfunc)wrap_binaryfunc,
! 	 "x.__getattribute__('name') <==> x.name"},
  	{0}
  };
***************
*** 2878,2882 ****
  
  	if (getattr_str == NULL) {
! 		getattr_str = PyString_InternFromString("__getattr__");
  		if (getattr_str == NULL)
  			return NULL;
--- 2878,2882 ----
  
  	if (getattr_str == NULL) {
! 		getattr_str = PyString_InternFromString("__getattribute__");
  		if (getattr_str == NULL)
  			return NULL;
***************
*** 3197,3201 ****
  	TPSLOT("__call__", tp_call, slot_tp_call);
  	TPSLOT("__str__", tp_str, slot_tp_str);
! 	TPSLOT("__getattr__", tp_getattro, slot_tp_getattro);
  	TPSLOT("__setattr__", tp_setattro, slot_tp_setattro);
  	TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare);
--- 3197,3201 ----
  	TPSLOT("__call__", tp_call, slot_tp_call);
  	TPSLOT("__str__", tp_str, slot_tp_str);
! 	TPSLOT("__getattribute__", tp_getattro, slot_tp_getattro);
  	TPSLOT("__setattr__", tp_setattro, slot_tp_setattro);
  	TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare);