Skip to content

Commit 23e275b

Browse files
committed
Port UCS1 and charmap codecs to new API.
1 parent 9e81668 commit 23e275b

3 files changed

Lines changed: 134 additions & 89 deletions

File tree

‎Include/unicodeobject.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,12 @@ PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap(
14251425
(unicode ordinal -> char ordinal) */
14261426
const char *errors /* error handling */
14271427
);
1428+
PyAPI_FUNC(PyObject*) _PyUnicode_EncodeCharmap(
1429+
PyObject *unicode, /* Unicode object */
1430+
PyObject *mapping, /* character mapping
1431+
(unicode ordinal -> char ordinal) */
1432+
const char *errors /* error handling */
1433+
);
14281434
#endif
14291435

14301436
/* Translate a Py_UNICODE buffer of the given length by applying a

‎Modules/_codecsmodule.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,11 +992,7 @@ charmap_encode(PyObject *self,
992992
str = PyUnicode_FromObject(str);
993993
if (str == NULL)
994994
return NULL;
995-
v = codec_tuple(PyUnicode_EncodeCharmap(
996-
PyUnicode_AS_UNICODE(str),
997-
PyUnicode_GET_SIZE(str),
998-
mapping,
999-
errors),
995+
v = codec_tuple(_PyUnicode_EncodeCharmap(str, mapping, errors),
1000996
PyUnicode_GET_SIZE(str));
1001997
Py_DECREF(str);
1002998
return v;

0 commit comments

Comments
 (0)