Mercurial > cpython-lru_cache-weakref
diff Python/codecs.c @ 41878:089f449a20cd
Change PyErr_Format() to generate a unicode string (by using
PyUnicode_FromFormatV() instead of PyString_FromFormatV()).
Change calls to PyErr_Format() to benefit from the new format
specifiers: Using %S, object instead of %s, PyString_AS_STRING(object)
with will work with unicode objects too.
| author | Walter Dörwald <walter@livinglogic.de> |
|---|---|
| date | Fri, 25 May 2007 15:46:59 +0000 |
| parents | 15b810e21fe9 |
| children | 36b8d74deb9e |
line wrap: on
line diff
--- a/Python/codecs.c Fri May 25 14:14:31 2007 +0000 +++ b/Python/codecs.c Fri May 25 15:46:59 2007 +0000 @@ -443,18 +443,13 @@ { PyObject *type = PyObject_GetAttrString(exc, "__class__"); if (type != NULL) { - PyObject *name = PyObject_GetAttrString(type, "__name__"); - Py_DECREF(type); - if (name != NULL) { - PyObject *string = PyObject_Str(name); - Py_DECREF(name); - if (string != NULL) { - PyErr_Format(PyExc_TypeError, - "don't know how to handle %.400s in error callback", - PyString_AS_STRING(string)); - Py_DECREF(string); - } - } + PyObject *name = PyObject_GetAttrString(type, "__name__"); + Py_DECREF(type); + if (name != NULL) { + PyErr_Format(PyExc_TypeError, + "don't know how to handle %S in error callback", name); + Py_DECREF(name); + } } }
