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_Encode
  • Loading branch information
methane committed May 4, 2021
commit 9b6e93591c77ec44d12ab663fe420617239f1f16
14 changes: 0 additions & 14 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1027,20 +1027,6 @@ These are the generic codec APIs:
the codec.


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

Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a Python
bytes object. *encoding* and *errors* have the same meaning as the
parameters of the same name in the Unicode :meth:`~str.encode` method. The codec
to be used is looked up using the Python codec registry. 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_AsEncodedString`.


UTF-8 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 @@ -2474,12 +2474,6 @@ PyUnicode_DecodeUTF8Stateful:Py_ssize_t:size::
PyUnicode_DecodeUTF8Stateful:const char*:errors::
PyUnicode_DecodeUTF8Stateful:Py_ssize_t*:consumed::

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

PyUnicode_AsEncodedString:PyObject*::+1:
PyUnicode_AsEncodedString:PyObject*:unicode:0:
PyUnicode_AsEncodedString:const char*:encoding::
Expand Down
11 changes: 0 additions & 11 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -743,17 +743,6 @@ PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);

#define _PyUnicode_AsString PyUnicode_AsUTF8

/* --- Generic Codecs ----------------------------------------------------- */

/* Encodes a Py_UNICODE buffer of the given size and returns a
Python string object. */
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_Encode(
const Py_UNICODE *s, /* Unicode char buffer */
Py_ssize_t size, /* number of Py_UNICODE chars to encode */
const char *encoding, /* encoding */
const char *errors /* error handling */
);

/* --- UTF-7 Codecs ------------------------------------------------------- */

Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
Expand Down
16 changes: 0 additions & 16 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3730,22 +3730,6 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
return NULL;
}

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

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

PyObject *
PyUnicode_AsEncodedObject(PyObject *unicode,
const char *encoding,
Expand Down
0