Check error when calling PyUnicode_AppendAndDel()

This commit is contained in:
Victor Stinner 2011-10-02 20:35:10 +02:00
parent 1a15aba71d
commit 67002af323
2 changed files with 7 additions and 5 deletions

View file

@ -944,9 +944,9 @@ void _ctypes_extend_error(PyObject *exc_class, char *fmt, ...)
else {
PyErr_Clear();
PyUnicode_AppendAndDel(&s, PyUnicode_FromString("???"));
if (s == NULL)
goto error;
}
if (s == NULL)
goto error;
PyErr_SetObject(exc_class, s);
error:
Py_XDECREF(tp);