]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106320: Remove private _PyUnicode_AsString() alias (#107021)
authorVictor Stinner <vstinner@python.org>
Sat, 22 Jul 2023 13:15:05 +0000 (15:15 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jul 2023 13:15:05 +0000 (13:15 +0000)
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.

Include/cpython/unicodeobject.h
Misc/NEWS.d/next/C API/2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst [new file with mode: 0644]

index e75b5e154943dcf02fea46469599a51b5174b60b..51eb998db4ab6a001e1f74c70bb92e23da70f203 100644 (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
diff --git a/Misc/NEWS.d/next/C API/2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst b/Misc/NEWS.d/next/C API/2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst
new file mode 100644 (file)
index 0000000..1e0ba0d
--- /dev/null
@@ -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.