diff Objects/stringobject.c @ 8468:c27cd5fc46b5 legacy-trunk

Should check that PyObject_Str() really returned a string!
author Guido van Rossum <guido@python.org>
date Tue, 09 Jun 1998 15:08:41 +0000
parents 09963a2a24db
children 4fe8a7670c0d
line wrap: on
line diff
--- a/Objects/stringobject.c	Tue Jun 09 02:37:45 1998 +0000
+++ b/Objects/stringobject.c	Tue Jun 09 15:08:41 1998 +0000
@@ -900,6 +900,11 @@
 				temp = PyObject_Str(v);
 				if (temp == NULL)
 					goto error;
+				if (!PyString_Check(temp)) {
+					PyErr_SetString(PyExc_TypeError,
+					  "%s argument has non-string str()");
+					goto error;
+				}
 				buf = PyString_AsString(temp);
 				len = PyString_Size(temp);
 				if (prec >= 0 && len > prec)