mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-133968: Add PyUnicodeWriter_WriteASCII() function (#133973)
Replace most PyUnicodeWriter_WriteUTF8() calls with PyUnicodeWriter_WriteASCII(). Unrelated change to please the linter: remove an unused import in test_ctypes. 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
4109a9c6b3
commit
f49a07b531
17 changed files with 103 additions and 31 deletions
6
Python/Python-ast.c
generated
6
Python/Python-ast.c
generated
|
@ -5796,7 +5796,7 @@ ast_repr_list(PyObject *list, int depth)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -5820,7 +5820,7 @@ ast_repr_list(PyObject *list, int depth)
|
|||
}
|
||||
|
||||
if (i == 0 && length > 2) {
|
||||
if (PyUnicodeWriter_WriteUTF8(writer, ", ...", 5) < 0) {
|
||||
if (PyUnicodeWriter_WriteASCII(writer, ", ...", 5) < 0) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -5924,7 +5924,7 @@ ast_repr_max_depth(AST_object *self, int depth)
|
|||
}
|
||||
|
||||
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