mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)
Replace most PyUnicodeWriter_WriteUTF8() calls with
PyUnicodeWriter_WriteASCII().
(cherry picked from commit f49a07b531)
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
dba307a757
commit
3d69d18322
16 changed files with 98 additions and 31 deletions
|
|
@ -290,7 +290,7 @@ union_repr(PyObject *self)
|
|||
}
|
||||
|
||||
for (Py_ssize_t i = 0; i < len; i++) {
|
||||
if (i > 0 && PyUnicodeWriter_WriteUTF8(writer, " | ", 3) < 0) {
|
||||
if (i > 0 && PyUnicodeWriter_WriteASCII(writer, " | ", 3) < 0) {
|
||||
goto error;
|
||||
}
|
||||
PyObject *p = PyTuple_GET_ITEM(alias->args, i);
|
||||
|
|
@ -300,12 +300,12 @@ union_repr(PyObject *self)
|
|||
}
|
||||
|
||||
#if 0
|
||||
PyUnicodeWriter_WriteUTF8(writer, "|args=", 6);
|
||||
PyUnicodeWriter_WriteASCII(writer, "|args=", 6);
|
||||
PyUnicodeWriter_WriteRepr(writer, alias->args);
|
||||
PyUnicodeWriter_WriteUTF8(writer, "|h=", 3);
|
||||
PyUnicodeWriter_WriteASCII(writer, "|h=", 3);
|
||||
PyUnicodeWriter_WriteRepr(writer, alias->hashable_args);
|
||||
if (alias->unhashable_args) {
|
||||
PyUnicodeWriter_WriteUTF8(writer, "|u=", 3);
|
||||
PyUnicodeWriter_WriteASCII(writer, "|u=", 3);
|
||||
PyUnicodeWriter_WriteRepr(writer, alias->unhashable_args);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue