8000 bpo-44029: Remove Py_UNICODE APIs by methane · Pull Request #25881 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44029: Remove Py_UNICODE APIs #25881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 7, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove PyUnicode_EncodeUTF32
  • Loading branch information
methane committed May 4, 2021
commit 10d6d61557b01161f0cd3ad8234edbca0156e4c1
23 changes: 0 additions & 23 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1139,29 +1139,6 @@ These are the UTF-32 codec APIs:
Return ``NULL`` if an exception was raised by the codec.


.. c:function:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, \
const char *errors, int byteorder)

Return a Python bytes object holding the UTF-32 encoded value of the Unicode
data in *s*. Output is written according to the following byte order::

byteorder == -1: little endian
byteorder == 0: native byte order (writes a BOM mark)
byteorder == 1: big endian

If byteorder is ``0``, the output string will always start with the Unicode BOM
mark (U+FEFF). In the other two modes, no BOM mark is prepended.

If ``Py_UNICODE_WIDE`` is not defined, surrogate pairs will be output
as a single code point.

Return ``NULL`` if an exception was raised by the codec.

.. deprecated-removed:: 3.3 3.11
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
:c:func:`PyUnicode_AsUTF32String` or :c:func:`PyUnicode_AsEncodedString`.


UTF-16 Codecs
"""""""""""""

Expand Down
6 changes: 0 additions & 6 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2543,12 +2543,6 @@ PyUnicode_DecodeUTF32Stateful:Py_ssize_t*:consumed::
PyUnicode_AsUTF32String:PyObject*::+1:
PyUnicode_AsUTF32String:PyObject*:unicode:0:

PyUnicode_EncodeUTF32:PyObject*::+1:
PyUnicode_EncodeUTF32:const Py_UNICODE*:s::
PyUnicode_EncodeUTF32:Py_ssize_t:size::
PyUnicode_EncodeUTF32:const char*:errors::
PyUnicode_EncodeUTF32:int:byteorder::

PyUnicode_DecodeUnicodeEscape:PyObject*::+1:
PyUnicode_DecodeUnicodeEscape:const char*:s::
PyUnicode_DecodeUnicodeEscape:Py_ssize_t:size::
Expand Down
7 changes: 0 additions & 7 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,13 +768,6 @@ PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(

/* --- UTF-32 Codecs ------------------------------------------------------ */

Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors, /* error handling */
int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */
);

PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF32(
PyObject *object, /* Unicode object */
const char *errors, /* error handling */
Expand Down
15 changes: 0 additions & 15 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5998,21 +5998,6 @@ _PyUnicode_EncodeUTF32(PyObject *str,
return NULL;
}

PyObject *
PyUnicode_EncodeUTF32(const Py_UNICODE *s,
Py_ssize_t size,
const char *errors,
int byteorder)
{
PyObject *result;
PyObject *tmp = PyUnicode_FromWideChar(s, size);
if (tmp == NULL)
return NULL;
result = _PyUnicode_EncodeUTF32(tmp, errors, byteorder);
Py_DECREF(tmp);
return result;
}

PyObject *
PyUnicode_AsUTF32String(PyObject *unicode)
{
Expand Down
0