diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-02-15 12:25:42 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-02-15 14:34:20 +0000 |
commit | 9b2efb42ced1b57c8fc92512ac3692c8ded222b9 (patch) | |
tree | 0df1a73390f47c945ecaf62edb05a69ce7ba0422 | |
parent | 26b0fa4ad37b518175cbbba24ef78477429ec80d (diff) |
Handle deprecation of PyUnicode_WCHAR_KIND
Task-number: PYSIDE-2230
Change-Id: I3fd763b824417f95c096847bd9cefeb729245329
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 2942b9a7c9277c853e2eaccd35dc6def6c8d1608)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/libshiboken/helper.cpp | 4 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/pep384impl.h | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/sources/shiboken6/libshiboken/helper.cpp b/sources/shiboken6/libshiboken/helper.cpp index 8f836316e..c63dbd93b 100644 --- a/sources/shiboken6/libshiboken/helper.cpp +++ b/sources/shiboken6/libshiboken/helper.cpp @@ -155,9 +155,11 @@ static void formatPyUnicode(PyObject *obj, std::ostream &str) str << " (" << PyUnicode_GetLength(obj) << ')'; const auto kind = _PepUnicode_KIND(obj); switch (kind) { +#if PY_VERSION_HEX < 0x030C0000 case PepUnicode_WCHAR_KIND: str << " [wchar]"; break; +#endif case PepUnicode_1BYTE_KIND: str << " [1byte]"; break; @@ -178,8 +180,10 @@ static void formatPyUnicode(PyObject *obj, std::ostream &str) void *data =_PepUnicode_DATA(obj); str << ", data="; switch (kind) { +#if PY_VERSION_HEX < 0x030C0000 case PepUnicode_WCHAR_KIND: formatCharSequence(reinterpret_cast<const wchar_t *>(data), str); +#endif break; case PepUnicode_1BYTE_KIND: formatCharSequence(reinterpret_cast<const Py_UCS1 *>(data), str); diff --git a/sources/shiboken6/libshiboken/pep384impl.h b/sources/shiboken6/libshiboken/pep384impl.h index 07cdb3a6f..b69715566 100644 --- a/sources/shiboken6/libshiboken/pep384impl.h +++ b/sources/shiboken6/libshiboken/pep384impl.h @@ -201,7 +201,9 @@ LIBSHIBOKEN_API int Pep_GetVerboseFlag(void); LIBSHIBOKEN_API const char *_PepUnicode_AsString(PyObject *); enum PepUnicode_Kind { +#if PY_VERSION_HEX < 0x030C0000 PepUnicode_WCHAR_KIND = 0, +#endif PepUnicode_1BYTE_KIND = 1, PepUnicode_2BYTE_KIND = 2, PepUnicode_4BYTE_KIND = 4 @@ -216,7 +218,9 @@ LIBSHIBOKEN_API void *_PepUnicode_DATA(PyObject *str); #else enum PepUnicode_Kind { +#if PY_VERSION_HEX < 0x030C0000 PepUnicode_WCHAR_KIND = PyUnicode_WCHAR_KIND, +#endif PepUnicode_1BYTE_KIND = PyUnicode_1BYTE_KIND, PepUnicode_2BYTE_KIND = PyUnicode_2BYTE_KIND, PepUnicode_4BYTE_KIND = PyUnicode_4BYTE_KIND |