summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-07-22 13:15:05 (GMT)
committerGitHub <noreply@github.com>2023-07-22 13:15:05 (GMT)
commit463b56da1265a17e4207f651d6d5835a8d6de2dd (patch)
tree6fde62b4d3ed16217a665f06407c2dcd1024ac3b
parent76e20c361c8d6bc20d939d436a1c3d4077a58186 (diff)
downloadcpython-463b56da1265a17e4207f651d6d5835a8d6de2dd.zip
cpython-463b56da1265a17e4207f651d6d5835a8d6de2dd.tar.gz
cpython-463b56da1265a17e4207f651d6d5835a8d6de2dd.tar.bz2
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.
-rw-r--r--Include/cpython/unicodeobject.h5
-rw-r--r--Misc/NEWS.d/next/C API/2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst5
2 files changed, 5 insertions, 5 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index e75b5e1..51eb998 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -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
index 0000000..1e0ba0d
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2023-07-22-14-40-48.gh-issue-106320.H3u7x4.rst
@@ -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.