10000 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_EncodeUTF8
  • Loading branch information
methane committed May 4, 2021
commit a88d8ce1f5c2679433d719a80374f8711644aa47
12 changes: 0 additions & 12 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1089,18 +1089,6 @@ These are the UTF-8 codec APIs:
The return type is now ``const char *`` rather of ``char *``.


.. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors)

Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and
return a Python bytes object. 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_AsUTF8String`, :c:func:`PyUnicode_AsUTF8AndSize` or
:c:func:`PyUnicode_AsEncodedString`.


UTF-32 Codecs
"""""""""""""

Expand Down
5 changes: 0 additions & 5 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2502,11 +2502,6 @@ PyUnicode_DecodeUTF8:const char*:s::
PyUnicode_DecodeUTF8:Py_ssize_t:size::
PyUnicode_DecodeUTF8:const char*:errors::

PyUnicode_EncodeUTF8:PyObject*::+1:
PyUnicode_EncodeUTF8:const Py_UNICODE*:s::
PyUnicode_EncodeUTF8:Py_ssize_t:size::
PyUnicode_EncodeUTF8:const char*:errors::

PyUnicode_AsUTF8String:PyObject*::+1:
PyUnicode_AsUTF8String:PyObject*:unicode:0:

Expand Down
6 changes: 0 additions & 6 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,6 @@ PyAPI_FUNC(PyObject*) _PyUnicode_AsUTF8String(
PyObject *unicode,
const char *errors);

Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
const char *errors /* error handling */
);

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

Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32(
Expand Down
15 changes: 0 additions & 15 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5689,21 +5689,6 @@ _PyUnicode_AsUTF8String(PyObject *unicode, const char *errors)
}


PyObject *
PyUnicode_EncodeUTF8(const Py_UNICODE *s,
Py_ssize_t size,
const char *errors)
{
PyObject *v, *unicode;

unicode = PyUnicode_FromWideChar(s, size);
if (unicode == NULL)
return NULL;
v = _PyUnicode_AsUTF8String(unicode, errors);
Py_DECREF(unicode);
return v;
}

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