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
|
|
@ -192,7 +192,7 @@ constevaluator_call(PyObject *self, PyObject *args, PyObject *kwargs)
|
|||
for (Py_ssize_t i = 0; i < PyTuple_GET_SIZE(value); i++) {
|
||||
PyObject *item = PyTuple_GET_ITEM(value, i);
|
||||
if (i > 0) {
|
||||
if (PyUnicodeWriter_WriteUTF8(writer, ", ", 2) < 0) {
|
||||
if (PyUnicodeWriter_WriteASCII(writer, ", ", 2) < 0) {
|
||||
PyUnicodeWriter_Discard(writer);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ _Py_typing_type_repr(PyUnicodeWriter *writer, PyObject *p)
|
|||
}
|
||||
|
||||
if (p == (PyObject *)&_PyNone_Type) {
|
||||
return PyUnicodeWriter_WriteUTF8(writer, "None", 4);
|
||||
return PyUnicodeWriter_WriteASCII(writer, "None", 4);
|
||||
}
|
||||
|
||||
if ((rc = PyObject_HasAttrWithError(p, &_Py_ID(__origin__))) > 0 &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue