mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Check string for NULL before using it to format the error message.
(Spotted by Neal Norwitz)
This commit is contained in:
parent
70bb0d4e65
commit
f7bcd1d65c
1 changed files with 6 additions and 3 deletions
|
@ -465,9 +465,12 @@ static void wrong_exception_type(PyObject *exc)
|
|||
if (name != NULL) {
|
||||
PyObject *string = PyObject_Str(name);
|
||||
Py_DECREF(name);
|
||||
PyErr_Format(PyExc_TypeError, "don't know how to handle %.400s in error callback",
|
||||
PyString_AS_STRING(string));
|
||||
Py_DECREF(string);
|
||||
if (string != NULL) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"don't know how to handle %.400s in error callback",
|
||||
PyString_AS_STRING(string));
|
||||
Py_DECREF(string);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue