Add _PyUnicodeWriter_WriteASCIIString() function
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 @@
{
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 @@
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;
}