cpython: ebeed44702ec (original) (raw)
Mercurial > cpython
changeset 82388:ebeed44702ec 3.3
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. [#17223]
Victor Stinner victor.stinner@gmail.com | |
---|---|
date | Tue, 26 Feb 2013 00:27:38 +0100 |
parents | c354afedb866 |
children | 381de621ff6a 8928205f57f6 |
files | Lib/test/test_array.py Misc/NEWS Modules/arraymodule.c |
diffstat | 3 files changed, 12 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_array.py 6 Misc/NEWS 4 Modules/arraymodule.c 2 |
line wrap: on
line diff
--- a/Lib/test/test_array.py +++ b/Lib/test/test_array.py @@ -1069,6 +1069,12 @@ class UnicodeTest(StringTest, unittest.T self.assertRaises(TypeError, a.fromunicode)
- def test_issue17223(self):
# this used to crash[](#l1.8)
a = array.array('u', b'\xff' * 4)[](#l1.9)
self.assertRaises(ValueError, a.tounicode)[](#l1.10)
self.assertRaises(ValueError, str, a)[](#l1.11)
+ class NumberTest(BaseTest): def test_extslice(self):
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,10 @@ What's New in Python 3.3.1? 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.
--- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -2180,6 +2180,8 @@ array_repr(arrayobject *a) } else { v = array_tolist(a, NULL); }
s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v); Py_DECREF(v);