diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-11-19 11:54:53 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-11-19 11:54:53 (GMT) |
commit | 4a58707a340cacea6f8e6a82adfcc10a230e1185 (patch) | |
tree | 93f42c1524db7e6ba8a60f9a1f2c656c6e0931d9 /Objects/listobject.c | |
parent | 4d3f109ad3d1870130816b94a1f5d6f6c1a07586 (diff) | |
download | cpython-4a58707a340cacea6f8e6a82adfcc10a230e1185.zip cpython-4a58707a340cacea6f8e6a82adfcc10a230e1185.tar.gz cpython-4a58707a340cacea6f8e6a82adfcc10a230e1185.tar.bz2 |
Add _PyUnicodeWriter_WriteASCIIString() function
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 45666fd..7d5674c 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -339,19 +339,12 @@ list_repr(PyListObject *v) { Py_ssize_t i; PyObject *s; - static PyObject *sep = NULL; _PyUnicodeWriter writer; if (Py_SIZE(v) == 0) { return PyUnicode_FromString("[]"); } - if (sep == NULL) { - sep = PyUnicode_FromString(", "); - if (sep == NULL) - return NULL; - } - i = Py_ReprEnter((PyObject*)v); if (i != 0) { return i > 0 ? PyUnicode_FromString("[...]") : NULL; @@ -369,7 +362,7 @@ list_repr(PyListObject *v) so must refetch the list size on each iteration. */ for (i = 0; i < Py_SIZE(v); ++i) { if (i > 0) { - if (_PyUnicodeWriter_WriteStr(&writer, sep) < 0) + if (_PyUnicodeWriter_WriteASCIIString(&writer, ", ", 2) < 0) goto error; } |