Skip to content
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_EncodeUTF7
  • Loading branch information
methane committed May 4, 2021
commit d129b00d6f3ccb413e5475a8cb00593e91024529
17 changes: 0 additions & 17 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1211,23 +1211,6 @@ These are the UTF-7 codec APIs:
bytes that have been decoded will be stored in *consumed*.


.. c:function:: PyObject* PyUnicode_EncodeUTF7(const Py_UNICODE *s, Py_ssize_t size, \
int base64SetO, int base64WhiteSpace, const char *errors)

Encode the :c:type:`Py_UNICODE` buffer of the given size using UTF-7 and
return a Python bytes object. Return ``NULL`` if an exception was raised by
the codec.

If *base64SetO* is nonzero, "Set O" (punctuation that has no otherwise
special meaning) will be encoded in base-64. If *base64WhiteSpace* is
nonzero, whitespace will be encoded in base-64. Both are set to zero for the
Python "utf-7" 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`.


Unicode-Escape Codecs
"""""""""""""""""""""

Expand Down
7 changes: 0 additions & 7 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2490,13 +2490,6 @@ PyUnicode_DecodeUTF7Stateful:Py_ssize_t:size::
PyUnicode_DecodeUTF7Stateful:const char*:errors::
PyUnicode_DecodeUTF7Stateful:Py_ssize_t*:consumed::

PyUnicode_EncodeUTF7:PyObject*::+1:
PyUnicode_EncodeUTF7:const Py_UNICODE*:s::
PyUnicode_EncodeUTF7:Py_ssize_t:size::
PyUnicode_EncodeUTF7:int:base64SetO::
PyUnicode_EncodeUTF7:int:base64WhiteSpace::
PyUnicode_EncodeUTF7:const char*:errors::

PyUnicode_DecodeUTF8:PyObject*::+1:
PyUnicode_DecodeUTF8:const char*:s::
PyUnicode_DecodeUTF8:Py_ssize_t:size::
Expand Down
8 changes: 0 additions & 8 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -745,14 +745,6 @@ PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);

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

Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* number of Py_UNICODE chars to encode */
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */
const char *errors /* error handling */
);

PyAPI_FUNC(PyObject*) _PyUnicode_EncodeUTF7(
PyObject *unicode, /* Unicode object */
int base64SetO, /* Encode RFC2152 Set O characters in base64 */
Expand Down
16 changes: 0 additions & 16 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5031,22 +5031,6 @@ _PyUnicode_EncodeUTF7(PyObject *str,
return NULL;
return v;
}
PyObject *
PyUnicode_EncodeUTF7(const Py_UNICODE *s,
Py_ssize_t size,
int base64SetO,
int base64WhiteSpace,
const char *errors)
{
PyObject *result;
PyObject *tmp = PyUnicode_FromWideChar(s, size);
if (tmp == NULL)
return NULL;
result = _PyUnicode_EncodeUTF7(tmp, base64SetO,
base64WhiteSpace, errors);
Py_DECREF(tmp);
return result;
}

#undef IS_BASE64
#undef FROM_BASE64
Expand Down