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
|
|
@ -1512,7 +1512,7 @@ def visitModule(self, mod):
|
|||
|
||||
for (Py_ssize_t i = 0; i < Py_MIN(length, 2); i++) {
|
||||
if (i > 0) {
|
||||
if (PyUnicodeWriter_WriteUTF8(writer, ", ", 2) < 0) {
|
||||
if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1536,7 +1536,7 @@ def visitModule(self, mod):
|
|||
}
|
||||
|
||||
if (i == 0 && length > 2) {
|
||||
if (PyUnicodeWriter_WriteUTF8(writer, ", ...", 5) < 0) {
|
||||
if (PyUnicodeWriter_WriteASCII(writer, ", ...", 5) < 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1640,7 +1640,7 @@ def visitModule(self, mod):
|
|||
}
|
||||
|
||||
if (i > 0) {
|
||||
if (PyUnicodeWriter_WriteUTF8(writer, ", ", 2) < 0) {
|
||||
if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
|
||||
Py_DECREF(name);
|
||||
Py_DECREF(value_repr);
|
||||
goto error;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue