]> granicus.if.org Git - python/commitdiff
Undo this part of the previous checkin:
authorGuido van Rossum <guido@python.org>
Wed, 9 Oct 2002 19:14:30 +0000 (19:14 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 9 Oct 2002 19:14:30 +0000 (19:14 +0000)
  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.

Objects/stringobject.c

index 52f96ff07f82e01e3e1d0ec2022e609a1ee279e0..6a9450a21d97cfbc905850de02a904eb98aeabbc 100644 (file)
@@ -3874,10 +3874,11 @@ PyString_Format(PyObject *format, PyObject *args)
                                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;
                                }