summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-02-25 23:27:38 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-02-25 23:27:38 (GMT)
commit29ec595c6a705428784d24eb7e03681637c4eb03 (patch)
treed63517b2a435e09cbdf6126c6509b5a74a1cea06 /Modules/arraymodule.c
parentd21b58c05d5e187bb736dc913da6ddefd9c9d8b3 (diff)
downloadcpython-29ec595c6a705428784d24eb7e03681637c4eb03.zip
cpython-29ec595c6a705428784d24eb7e03681637c4eb03.tar.gz
cpython-29ec595c6a705428784d24eb7e03681637c4eb03.tar.bz2
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.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index adc4d5d..96c9e5b 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -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);