diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-05-25 15:46:59 +0000 |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-05-25 15:46:59 +0000 |
commit | 6f6f8683eb66f946844a8407d4739dc64b19e453 (patch) | |
tree | 11736d2ab16fe81a9529824bd30f3197cec1711b /Python/codecs.c | |
parent | 7376490d11acb9af72412145b96a4a43a789b86d (diff) | |
download | cpython-6f6f8683eb66f946844a8407d4739dc64b19e453.tar.gz |
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.
Diffstat (limited to 'Python/codecs.c')
-rw-r--r-- | Python/codecs.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Python/codecs.c b/Python/codecs.c index ddd19359ac..3aa1f386e7 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -443,18 +443,13 @@ static void wrong_exception_type(PyObject *exc) { 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); + } } } |