gh-106320: Remove private _PyUnicode_AsString() alias (#107021)

Remove private _PyUnicode_AsString() alias to PyUnicode_AsUTF8(). It
was kept for backward compatibility with Python 3.0 - 3.2.

The PyUnicode_AsUTF8() is available since Python
3.3. The PyUnicode_AsUTF8String() function can be used to keep
compatibility with Python 3.2 and older.
This commit is contained in:
Victor Stinner 2023-07-22 15:15:05 +02:00 • committed by GitHub
parent 76e20c361c
commit 463b56da12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -446,17 +446,12 @@ PyAPI_FUNC(PyObject*) PyUnicode_FromKindAndData(
Like PyUnicode_AsUTF8AndSize(), this also caches the UTF-8 representation
in the unicodeobject.
_PyUnicode_AsString is a #define for PyUnicode_AsUTF8 to
support the previous internal function with the same behaviour.
Use of this API is DEPRECATED since no size information can be
extracted from the returned data.
*/
PyAPI_FUNC(const char *) PyUnicode_AsUTF8(PyObject *unicode);
#define _PyUnicode_AsString PyUnicode_AsUTF8
/* === Characters Type APIs =============================================== */
/* These should not be used directly. Use the Py_UNICODE_IS* and

View file

@ -0,0 +1,5 @@
Remove private ``_PyUnicode_AsString()`` alias to
:c:func:`PyUnicode_AsUTF8`. It was kept for backward compatibility with
Python 3.0 - 3.2. The :c:func:`PyUnicode_AsUTF8` is available since Python
3.3. The :c:func:`PyUnicode_AsUTF8String` function can be used to keep
compatibility with Python 3.2 and older. Patch by Victor Stinner.