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_TranslateCharmap
  • Loading branch information
methane committed May 4, 2021
commit 391315849c0d243ebcb461d7b406c413d7b14048
13 changes: 0 additions & 13 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1349,19 +1349,6 @@ The following codec API is special in that maps Unicode to Unicode.
use the default error handling.


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

Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a
character *mapping* table to it and return the resulting Unicode object.
Return ``NULL`` when 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_Translate`. or :ref:`generic codec based API
<codec-registry>`


MBCS codecs for Windows
"""""""""""""""""""""""

Expand Down
6 changes: 0 additions & 6 deletions Doc/data/refcounts.dat
Original file line number Diff line number Diff line change
Expand Up @@ -2572,12 +2572,6 @@ PyUnicode_AsCharmapString:PyObject*::+1:
PyUnicode_AsCharmapString:PyObject*:unicode:0:
PyUnicode_AsCharmapString:PyObject*:mapping:0:

PyUnicode_TranslateCharmap:PyObject*::+1:
PyUnicode_TranslateCharmap:const Py_UNICODE*:s::
PyUnicode_TranslateCharmap:Py_ssize_t:size::
PyUnicode_TranslateCharmap:PyObject*:mapping:0:
PyUnicode_TranslateCharmap:const char*:errors::

PyUnicode_DecodeMBCS:PyObject*::+1:
PyUnicode_DecodeMBCS:const char*:s::
PyUnicode_DecodeMBCS:Py_ssize_t:size::
Expand Down
19 changes: 5 additions & 14 deletions Include/cpython/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -815,28 +815,19 @@ PyAPI_FUNC(PyObject*) _PyUnicode_AsASCIIString(

/* --- Character Map Codecs ----------------------------------------------- */

PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
PyObject *unicode, /* Unicode object */
PyObject *mapping, /* encoding mapping */
const char *errors /* error handling */
);

/* Translate a Py_UNICODE buffer of the given length by applying a
character mapping table to it and return the resulting Unicode
object.
/* Translate an Unicode object by applying a character mapping table to
it and return the resulting Unicode object.

The mapping table must map Unicode ordinal integers to Unicode strings,
Unicode ordinal integers or None (causing deletion of the character).

Mapping tables may be dictionaries or sequences. Unmapped character
ordinals (ones which cause a LookupError) are left untouched and
are copied as-is.

*/
Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap(
const Py_UNICODE *data, /* Unicode char buffer */
Py_ssize_t length, /* Number of Py_UNICODE chars to encode */
PyObject *table, /* Translate table */
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
PyObject *unicode, /* Unicode object */
PyObject *mapping, /* encoding mapping */
const char *errors /* error handling */
);

Expand Down
16 changes: 0 additions & 16 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -9297,22 +9297,6 @@ _PyUnicode_TranslateCharmap(PyObject *input,
return NULL;
}

/* Deprecated. Use PyUnicode_Translate instead. */
PyObject *
PyUnicode_TranslateCharmap(const Py_UNICODE *p,
Py_ssize_t size,
PyObject *mapping,
const char *errors)
{
PyObject *result;
PyObject *unicode = PyUnicode_FromWideChar(p, size);
if (!unicode)
return NULL;
result = _PyUnicode_TranslateCharmap(unicode, mapping, errors);
Py_DECREF(unicode);
return result;
}

PyObject *
PyUnicode_Translate(PyObject *str,
PyObject *mapping,
Expand Down