gh-133610: Remove PyUnicode_AsDecoded/Encoded functions (#133612)

This commit is contained in:
Stan Ulbrych 2025-05-09 16:31:24 +01:00 committed by GitHub
parent f34ec09ba5
commit 4fd1095280
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 90 deletions

View file

@ -3730,7 +3730,7 @@ PyUnicode_Decode(const char *s,
return NULL;
}
PyObject *
PyAPI_FUNC(PyObject *)
PyUnicode_AsDecodedObject(PyObject *unicode,
const char *encoding,
const char *errors)
@ -3740,12 +3740,6 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
return NULL;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyUnicode_AsDecodedObject() is deprecated "
"and will be removed in 3.15; "
"use PyCodec_Decode() to decode from str", 1) < 0)
return NULL;
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@ -3753,7 +3747,7 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
return PyCodec_Decode(unicode, encoding, errors);
}
PyObject *
PyAPI_FUNC(PyObject *)
PyUnicode_AsDecodedUnicode(PyObject *unicode,
const char *encoding,
const char *errors)
@ -3765,12 +3759,6 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
goto onError;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyUnicode_AsDecodedUnicode() is deprecated "
"and will be removed in 3.15; "
"use PyCodec_Decode() to decode from str to str", 1) < 0)
return NULL;
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@ -3793,7 +3781,7 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
return NULL;
}
PyObject *
PyAPI_FUNC(PyObject *)
PyUnicode_AsEncodedObject(PyObject *unicode,
const char *encoding,
const char *errors)
@ -3805,13 +3793,6 @@ PyUnicode_AsEncodedObject(PyObject *unicode,
goto onError;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyUnicode_AsEncodedObject() is deprecated "
"and will be removed in 3.15; "
"use PyUnicode_AsEncodedString() to encode from str to bytes "
"or PyCodec_Encode() for generic encoding", 1) < 0)
return NULL;
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@ -4017,7 +3998,7 @@ PyUnicode_AsEncodedString(PyObject *unicode,
return NULL;
}
PyObject *
PyAPI_FUNC(PyObject *)
PyUnicode_AsEncodedUnicode(PyObject *unicode,
const char *encoding,
const char *errors)
@ -4029,12 +4010,6 @@ PyUnicode_AsEncodedUnicode(PyObject *unicode,
goto onError;
}
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"PyUnicode_AsEncodedUnicode() is deprecated "
"and will be removed in 3.15; "
"use PyCodec_Encode() to encode from str to str", 1) < 0)
return NULL;
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();