diff options
author | Guido van Rossum <guido@python.org> | 2002-10-09 19:14:30 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-10-09 19:14:30 +0000 |
commit | b82630a3af1228edf1ef36024aaa8ac48a216924 (patch) | |
tree | 8edaee7148794a6f713d4a9611a4a80376b8564a /Objects/stringobject.c | |
parent | eedce9d849e64f943ebb0087dc735511c5480f3c (diff) | |
download | cpython-b82630a3af1228edf1ef36024aaa8ac48a216924.tar.gz |
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.
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r-- | Objects/stringobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c index 52f96ff07f..6a9450a21d 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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; } |