[Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.104,2.105

Guido van Rossum gvanrossum@users.sourceforge.net
Tue, 01 May 2001 09:51:55 -0700


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

Modified Files:
	stringobject.c 
Log Message:
Add a proper implementation for the tp_str slot (returning self, of
course), so I can get rid of the special case for strings in
PyObject_Str().


Index: stringobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v
retrieving revision 2.104
retrieving revision 2.105
diff -C2 -r2.104 -r2.105
*** stringobject.c	2001/04/28 05:38:26	2.104
--- stringobject.c	2001/05/01 16:51:53	2.105
***************
*** 402,405 ****
--- 402,412 ----
  }
  
+ static PyObject *
+ string_str(PyObject *s)
+ {
+ 	Py_INCREF(s);
+ 	return s;
+ }
+ 
  static int
  string_length(PyStringObject *a)
***************
*** 2375,2379 ****
  	(hashfunc)string_hash, /*tp_hash*/
  	0,		/*tp_call*/
! 	0,		/*tp_str*/
  	0,		/*tp_getattro*/
  	0,		/*tp_setattro*/
--- 2382,2386 ----
  	(hashfunc)string_hash, /*tp_hash*/
  	0,		/*tp_call*/
! 	(reprfunc)string_str,	/*tp_str*/
  	0,		/*tp_getattro*/
  	0,		/*tp_setattro*/