diff Objects/stringobject.c @ 17946:e1816f649ff8 2.1

Net result of Guido's checkins of object.c (2.125 and 2.126), classobject.c (2.128) and stringobject.c (2.105), which reworks PyObject_Str() and PyObject_Repr() so strings and instances aren't special-cased, and print >> file, instance works like expected in all cases.
author Thomas Wouters <thomas@python.org>
date Wed, 23 May 2001 13:03:13 +0000
parents 096072d88798
children 5d894a5fce38
line wrap: on
line diff
--- a/Objects/stringobject.c	Wed May 23 12:51:22 2001 +0000
+++ b/Objects/stringobject.c	Wed May 23 13:03:13 2001 +0000
@@ -401,6 +401,13 @@
 	}
 }
 
+static PyObject *
+string_str(PyObject *s)
+{
+	Py_INCREF(s);
+	return s;
+}
+
 static int
 string_length(PyStringObject *a)
 {
@@ -2374,7 +2381,7 @@
 	0,		/*tp_as_mapping*/
 	(hashfunc)string_hash, /*tp_hash*/
 	0,		/*tp_call*/
-	0,		/*tp_str*/
+	(reprfunc)string_str,	/*tp_str*/
 	0,		/*tp_getattro*/
 	0,		/*tp_setattro*/
 	&string_as_buffer,	/*tp_as_buffer*/