Mercurial > cpython-lru_cache-weakref
comparison Modules/arraymodule.c @ 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 | 3ca72d4e9762 |
| children | 381de621ff6a |
comparison
equal
deleted
inserted
replaced
| 82386:c354afedb866 | 82388:ebeed44702ec |
|---|---|
| 2178 if (typecode == 'u') { | 2178 if (typecode == 'u') { |
| 2179 v = array_tounicode(a, NULL); | 2179 v = array_tounicode(a, NULL); |
| 2180 } else { | 2180 } else { |
| 2181 v = array_tolist(a, NULL); | 2181 v = array_tolist(a, NULL); |
| 2182 } | 2182 } |
| 2183 if (v == NULL) | |
| 2184 return NULL; | |
| 2183 | 2185 |
| 2184 s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v); | 2186 s = PyUnicode_FromFormat("array('%c', %R)", (int)typecode, v); |
| 2185 Py_DECREF(v); | 2187 Py_DECREF(v); |
| 2186 return s; | 2188 return s; |
| 2187 } | 2189 } |
