Skip to content

Commit 0106cd5

Browse files
committed
Rename to PyUnicodeWriter_WriteUTF8()
1 parent d2ebf66 commit 0106cd5

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

Include/cpython/unicodeobject.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,12 @@ PyAPI_FUNC(void) PyUnicodeWriter_SetOverallocate(
459459
PyAPI_FUNC(int) PyUnicodeWriter_WriteChar(
460460
PyUnicodeWriter *writer,
461461
Py_UCS4 ch);
462-
PyAPI_FUNC(int) PyUnicodeWriter_WriteString(
462+
PyAPI_FUNC(int) PyUnicodeWriter_WriteUTF8(
463463
PyUnicodeWriter *writer,
464464
const char *str,
465465
Py_ssize_t size);
466466

467-
PyAPI_FUNC(int) PyUnicodeWriter_WriteStr(
467+
PyAPI_FUNC(int) PyUnicodeWriter_WriteString(
468468
PyUnicodeWriter *writer,
469469
PyObject *str);
470470
PyAPI_FUNC(int) PyUnicodeWriter_WriteSubstring(

Modules/_testcapi/unicode.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ test_unicodewriter(PyObject *self, PyObject *Py_UNUSED(args))
232232
// test PyUnicodeWriter_SetOverallocate()
233233
PyUnicodeWriter_SetOverallocate(writer, 1);
234234

235-
// test PyUnicodeWriter_WriteStr()
235+
// test PyUnicodeWriter_WriteString()
236236
PyObject *str = PyUnicode_FromString("var");
237237
if (str == NULL) {
238238
goto error;
239239
}
240-
int ret = PyUnicodeWriter_WriteStr(writer, str);
240+
int ret = PyUnicodeWriter_WriteString(writer, str);
241241
Py_CLEAR(str);
242242
if (ret < 0) {
243243
goto error;
@@ -259,8 +259,8 @@ test_unicodewriter(PyObject *self, PyObject *Py_UNUSED(args))
259259
goto error;
260260
}
261261

262-
// test PyUnicodeWriter_WriteString()
263-
if (PyUnicodeWriter_WriteString(writer, " value", 6) < 0) {
262+
// test PyUnicodeWriter_WriteUTF8()
263+
if (PyUnicodeWriter_WriteUTF8(writer, " value", 6) < 0) {
264264
goto error;
265265
}
266266

@@ -286,19 +286,19 @@ test_unicodewriter_utf8(PyObject *self, PyObject *Py_UNUSED(args))
286286
if (writer == NULL) {
287287
return NULL;
288288
}
289-
if (PyUnicodeWriter_WriteString(writer, "ascii", -1) < 0) {
289+
if (PyUnicodeWriter_WriteUTF8(writer, "ascii", -1) < 0) {
290290
goto error;
291291
}
292292
if (PyUnicodeWriter_WriteChar(writer, '-') < 0) {
293293
goto error;
294294
}
295-
if (PyUnicodeWriter_WriteString(writer, "latin1=\xC3\xA9", -1) < 0) {
295+
if (PyUnicodeWriter_WriteUTF8(writer, "latin1=\xC3\xA9", -1) < 0) {
296296
goto error;
297297
}
298298
if (PyUnicodeWriter_WriteChar(writer, '-') < 0) {
299299
goto error;
300300
}
301-
if (PyUnicodeWriter_WriteString(writer, "euro=\xE2\x82\xAC", -1) < 0) {
301+
if (PyUnicodeWriter_WriteUTF8(writer, "euro=\xE2\x82\xAC", -1) < 0) {
302302
goto error;
303303
}
304304
if (PyUnicodeWriter_WriteChar(writer, '.') < 0) {
@@ -328,7 +328,7 @@ test_unicodewriter_invalid_utf8(PyObject *self, PyObject *Py_UNUSED(args))
328328
if (writer == NULL) {
329329
return NULL;
330330
}
331-
assert(PyUnicodeWriter_WriteString(writer, "invalid=\xFF", -1) < 0);
331+
assert(PyUnicodeWriter_WriteUTF8(writer, "invalid=\xFF", -1) < 0);
332332
PyUnicodeWriter_Free(writer);
333333

334334
assert(PyErr_ExceptionMatches(PyExc_UnicodeDecodeError));

Objects/unicodeobject.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4946,7 +4946,7 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
49464946
}
49474947

49484948

4949-
// Used by PyUnicodeWriter_WriteString() implementation
4949+
// Used by PyUnicodeWriter_WriteUTF8() implementation
49504950
static int
49514951
unicode_decode_utf8_writer(_PyUnicodeWriter *writer,
49524952
const char *s, Py_ssize_t size,
@@ -13401,7 +13401,7 @@ _PyUnicodeWriter_WriteStr(_PyUnicodeWriter *writer, PyObject *str)
1340113401
}
1340213402

1340313403
int
13404-
PyUnicodeWriter_WriteStr(PyUnicodeWriter *writer, PyObject *str)
13404+
PyUnicodeWriter_WriteString(PyUnicodeWriter *writer, PyObject *str)
1340513405
{
1340613406
if (!PyUnicode_Check(str)) {
1340713407
PyErr_Format(PyExc_TypeError, "expect str, not %T", str);
@@ -13527,9 +13527,9 @@ _PyUnicodeWriter_WriteASCIIString(_PyUnicodeWriter *writer,
1352713527
}
1352813528

1352913529
int
13530-
PyUnicodeWriter_WriteString(PyUnicodeWriter *writer,
13531-
const char *str,
13532-
Py_ssize_t size)
13530+
PyUnicodeWriter_WriteUTF8(PyUnicodeWriter *writer,
13531+
const char *str,
13532+
Py_ssize_t size)
1353313533
{
1353413534
if (size == -1) {
1353513535
size = strlen(str);

0 commit comments

Comments
 (0)