diff Lib/test/test_array.py @ 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.
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 26 Feb 2013 00:27:38 +0100
parents 1538307c06c0
children 66e9d0185b0f 381de621ff6a
line wrap: on
line diff
--- a/Lib/test/test_array.py	Tue Feb 26 00:15:54 2013 +0100
+++ b/Lib/test/test_array.py	Tue Feb 26 00:27:38 2013 +0100
@@ -1069,6 +1069,12 @@
 
         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):