invalid characters (outside range [U+0000; U+10ffff]) to Unicode: repr(array),
str(array) and array.tounicode(). Patch written by Manuel Jacob.
self.assertRaises(TypeError, a.fromunicode)
+ def test_issue17223(self):
+ # this used to crash
+ a = array.array('u', b'\xff' * 4)
+ self.assertRaises(ValueError, a.tounicode)
+ self.assertRaises(ValueError, str, a)
+
class NumberTest(BaseTest):
def test_extslice(self):
Core and Builtins
-----------------
+- 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.
+
- Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character outside
the range U+0000-U+10ffff.
} else {
v = array_tolist(a, NULL);
}
+ if (v == NULL)
+ return NULL;
s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v);
Py_DECREF(v);