Skip to content

Commit 8bf6305

Browse files
authored
gh-158451: Remove _PyUnicodeWriter_WriteASCIIString() read-only optim (#159141)
The optimization is not worth it, _PyUnicode_FromASCII() doesn't make anything special.
1 parent 230917f commit 8bf6305

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

‎Objects/unicode_writer.c‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,18 +401,7 @@ _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
401401
return 0;
402402
}
403403

404-
assert(ucs1lib_find_max_char((const Py_UCS1*)ascii, (const Py_UCS1*)ascii + len) < 128);
405-
406-
if (writer->buffer == NULL && !writer->overallocate) {
407-
PyObject *str;
408-
409-
str = _PyUnicode_FromASCII(ascii, len);
410-
if (str == NULL)
411-
return -1;
412-
413-
_PyUnicodeWriter_SetReadOnly(writer, str, len);
414-
return 0;
415-
}
404+
assert(ucs1lib_find_max_char((const Py_UCS1*)ascii, (const Py_UCS1*)ascii + len) <= 127);
416405

417406
if (_PyUnicodeWriter_Prepare(writer, len, 127) == -1) {
418407
return -1;

0 commit comments

Comments
 (0)