summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-04-22 11:05:36 (GMT)
committerGitHub <noreply@github.com>2022-04-22 11:05:36 (GMT)
commit9e146bbb7e1c0d872817ac63c60454a201b50039 (patch)
tree0ae6a1a7f3aafc0bc6f4be535b01cef621f33129 /Include
parent82ec638ab706577c043056a57e2a2322b43ef94a (diff)
downloadcpython-9e146bbb7e1c0d872817ac63c60454a201b50039.zip
cpython-9e146bbb7e1c0d872817ac63c60454a201b50039.tar.gz
cpython-9e146bbb7e1c0d872817ac63c60454a201b50039.tar.bz2
gh-80527: Deprecate PEP 623 Unicode functions (#91801)
Deprecate functions: * PyUnicode_AS_DATA() * PyUnicode_AS_UNICODE() * PyUnicode_GET_DATA_SIZE() * PyUnicode_GET_SIZE() Previously, these functions were macros and so it wasn't possible to decorate them with Py_DEPRECATED().
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/unicodeobject.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index 5d050fd..992588c 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -613,7 +613,7 @@ static inline Py_ssize_t PyUnicode_WSTR_LENGTH(PyObject *op)
If the Py_UNICODE representation is not available, it will be computed
on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
-/* Py_DEPRECATED(3.3) */
+Py_DEPRECATED(3.3)
static inline Py_ssize_t PyUnicode_GET_SIZE(PyObject *op)
{
_Py_COMP_DIAG_PUSH
@@ -627,10 +627,13 @@ static inline Py_ssize_t PyUnicode_GET_SIZE(PyObject *op)
}
#define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op))
- /* Py_DEPRECATED(3.3) */
- static inline Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *op)
+Py_DEPRECATED(3.3)
+static inline Py_ssize_t PyUnicode_GET_DATA_SIZE(PyObject *op)
{
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
return PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE;
+ _Py_COMP_DIAG_POP
}
#define PyUnicode_GET_DATA_SIZE(op) PyUnicode_GET_DATA_SIZE(_PyObject_CAST(op))
@@ -639,7 +642,7 @@ static inline Py_ssize_t PyUnicode_GET_SIZE(PyObject *op)
try to port your code to use the new PyUnicode_*BYTE_DATA() macros or
use PyUnicode_WRITE() and PyUnicode_READ(). */
-/* Py_DEPRECATED(3.3) */
+Py_DEPRECATED(3.3)
static inline Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *op)
{
wchar_t *wstr = _PyASCIIObject_CAST(op)->wstr;
@@ -654,10 +657,13 @@ static inline Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *op)
}
#define PyUnicode_AS_UNICODE(op) PyUnicode_AS_UNICODE(_PyObject_CAST(op))
-/* Py_DEPRECATED(3.3) */
+Py_DEPRECATED(3.3)
static inline const char* PyUnicode_AS_DATA(PyObject *op)
{
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
return (const char *)PyUnicode_AS_UNICODE(op);
+ _Py_COMP_DIAG_POP
}
#define PyUnicode_AS_DATA(op) PyUnicode_AS_DATA(_PyObject_CAST(op))