diff Modules/arraymodule.c @ 82389:381de621ff6a

(Merge 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:56 +0100
parents 0a095821c74e ebeed44702ec
children d85b0c355052
line wrap: on
line diff
--- a/Modules/arraymodule.c	Tue Feb 26 00:16:57 2013 +0100
+++ b/Modules/arraymodule.c	Tue Feb 26 00:27:56 2013 +0100
@@ -2177,6 +2177,8 @@
     } else {
         v = array_tolist(a, NULL);
     }
+    if (v == NULL)
+        return NULL;
 
     s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v);
     Py_DECREF(v);