mirror of
https://github.com/python/cpython.git
synced 2025-10-16 19:57:59 +00:00
Should check that PyObject_Str() really returned a string!
This commit is contained in:
parent
fe02efdbf4
commit
4a0144c0de
1 changed files with 5 additions and 0 deletions
|
@ -900,6 +900,11 @@ PyString_Format(format, args)
|
||||||
temp = PyObject_Str(v);
|
temp = PyObject_Str(v);
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
if (!PyString_Check(temp)) {
|
||||||
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
"%s argument has non-string str()");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
buf = PyString_AsString(temp);
|
buf = PyString_AsString(temp);
|
||||||
len = PyString_Size(temp);
|
len = PyString_Size(temp);
|
||||||
if (prec >= 0 && len > prec)
|
if (prec >= 0 && len > prec)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue