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
|
|
@ -1798,9 +1798,24 @@ object.
|
|||
|
||||
See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`.
|
||||
|
||||
.. c:function:: int PyUnicodeWriter_WriteASCII(PyUnicodeWriter *writer, const char *str, Py_ssize_t size)
|
||||
|
||||
Write the ASCII string *str* into *writer*.
|
||||
|
||||
*size* is the string length in bytes. If *size* is equal to ``-1``, call
|
||||
``strlen(str)`` to get the string length.
|
||||
|
||||
*str* must only contain ASCII characters. The behavior is undefined if
|
||||
*str* contains non-ASCII characters.
|
||||
|
||||
On success, return ``0``.
|
||||
On error, set an exception, leave the writer unchanged, and return ``-1``.
|
||||
|
||||
.. versionadded:: next
|
||||
|
||||
.. c:function:: int PyUnicodeWriter_WriteWideChar(PyUnicodeWriter *writer, const wchar_t *str, Py_ssize_t size)
|
||||
|
||||
Writer the wide string *str* into *writer*.
|
||||
Write the wide string *str* into *writer*.
|
||||
|
||||
*size* is a number of wide characters. If *size* is equal to ``-1``, call
|
||||
``wcslen(str)`` to get the string length.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue