diff options
author | Inada Naoki <songofacandy@gmail.com> | 2021-05-07 06:58:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 06:58:29 (GMT) |
commit | 9ad8f109ac037ac088e09dcd2da523322c5caf34 (patch) | |
tree | d125df68405fd1e98f3edf67d9e3c52b679688f5 /Modules | |
parent | 4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0 (diff) | |
download | cpython-9ad8f109ac037ac088e09dcd2da523322c5caf34.zip cpython-9ad8f109ac037ac088e09dcd2da523322c5caf34.tar.gz cpython-9ad8f109ac037ac088e09dcd2da523322c5caf34.tar.bz2 |
bpo-44029: Remove Py_UNICODE APIs (GH-25881)
Remove deprecated `Py_UNICODE` APIs: `PyUnicode_Encode`,
`PyUnicode_EncodeUTF7`, `PyUnicode_EncodeUTF8`,
`PyUnicode_EncodeUTF16`, `PyUnicode_EncodeUTF32`,
`PyUnicode_EncodeLatin1`, `PyUnicode_EncodeMBCS`,
`PyUnicode_EncodeDecimal`, `PyUnicode_EncodeRawUnicodeEscape`,
`PyUnicode_EncodeCharmap`, `PyUnicode_EncodeUnicodeEscape`,
`PyUnicode_TransformDecimalToASCII`, `PyUnicode_TranslateCharmap`,
`PyUnicodeEncodeError_Create`, `PyUnicodeTranslateError_Create`.
See :pep:`393` and :pep:`624` for reference.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_pickle.c | 2 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 47 |
2 files changed, 1 insertions, 48 deletions
diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 691d4a2..3e74faf 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -2570,7 +2570,7 @@ save_picklebuffer(PicklerObject *self, PyObject *obj) return 0; } -/* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates +/* A copy of PyUnicode_AsRawUnicodeEscapeString() that also translates backslash and newline characters to \uXXXX escapes. */ static PyObject * raw_unicode_escape(PyObject *obj) diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index d926ad8..0c48acc 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2155,51 +2155,6 @@ _Py_COMP_DIAG_PUSH _Py_COMP_DIAG_IGNORE_DEPR_DECLS static PyObject * -unicode_encodedecimal(PyObject *self, PyObject *args) -{ - Py_UNICODE *unicode; - Py_ssize_t length; - char *errors = NULL; - PyObject *decimal; - Py_ssize_t decimal_length, new_length; - int res; - - if (!PyArg_ParseTuple(args, "u#|s", &unicode, &length, &errors)) - return NULL; - - decimal_length = length * 7; /* len('€') */ - decimal = PyBytes_FromStringAndSize(NULL, decimal_length); - if (decimal == NULL) - return NULL; - - res = PyUnicode_EncodeDecimal(unicode, length, - PyBytes_AS_STRING(decimal), - errors); - if (res < 0) { - Py_DECREF(decimal); - return NULL; - } - - new_length = strlen(PyBytes_AS_STRING(decimal)); - assert(new_length <= decimal_length); - res = _PyBytes_Resize(&decimal, new_length); - if (res < 0) - return NULL; - - return decimal; -} - -static PyObject * -unicode_transformdecimaltoascii(PyObject *self, PyObject *args) -{ - Py_UNICODE *unicode; - Py_ssize_t length; - if (!PyArg_ParseTuple(args, "u#|s", &unicode, &length)) - return NULL; - return PyUnicode_TransformDecimalToASCII(unicode, length); -} - -static PyObject * unicode_legacy_string(PyObject *self, PyObject *args) { Py_UNICODE *data; @@ -5737,8 +5692,6 @@ static PyMethodDef TestMethods[] = { {"unicode_findchar", unicode_findchar, METH_VARARGS}, {"unicode_copycharacters", unicode_copycharacters, METH_VARARGS}, #if USE_UNICODE_WCHAR_CACHE - {"unicode_encodedecimal", unicode_encodedecimal, METH_VARARGS}, - {"unicode_transformdecimaltoascii", unicode_transformdecimaltoascii, METH_VARARGS}, {"unicode_legacy_string", unicode_legacy_string, METH_VARARGS}, #endif /* USE_UNICODE_WCHAR_CACHE */ {"_test_thread_state", test_thread_state, METH_VARARGS}, |