Issue #17223: array module: Fix a crasher when converting an array containing

invalid characters (outside range [U+0000; U+10ffff]) to Unicode: repr(array),
str(array) and array.tounicode(). Patch written by Manuel Jacob.
This commit is contained in:
Victor Stinner 2013-02-26 00:27:38 +01:00
parent d21b58c05d
commit 29ec595c6a
3 changed files with 12 additions and 0 deletions

View file

@ -2180,6 +2180,8 @@ array_repr(arrayobject *a)
} else {
v = array_tolist(a, NULL);
}
if (v == NULL)
return NULL;
s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v);
Py_DECREF(v);