diff Objects/stringobject.c @ 25683:38843d35b646 legacy-trunk

Undo this part of the previous checkin: Also fixed an error message -- %s argument has non-string str() doesn't make sense for %r, so the error message now differentiates between %s and %r. because PyObject_Repr() and PyObject_Str() ensure that this can never happen. Added a helpful comment instead.
author Guido van Rossum <guido@python.org>
date Wed, 09 Oct 2002 19:14:30 +0000
parents ce49f12a1769
children f532e9b69551
line wrap: on
line diff
--- a/Objects/stringobject.c	Wed Oct 09 19:07:53 2002 +0000
+++ b/Objects/stringobject.c	Wed Oct 09 19:14:30 2002 +0000
@@ -3874,10 +3874,11 @@
 				if (temp == NULL)
 					goto error;
 				if (!PyString_Check(temp)) {
+					/* XXX Note: this should never happen,
+					   since PyObject_Repr() and
+					   PyObject_Str() assure this */
 					PyErr_SetString(PyExc_TypeError,
-					  c == 's' ?
-					  "%s argument has non-string str()" :
-					  "%r argument has non-string repr()");
+					  "%s argument has non-string str()");
 					Py_DECREF(temp);
 					goto error;
 				}