diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-09 13:59:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-11 22:20:46 +0200 |
commit | 47a6faf8636a78398a1b2eb69210bfd6174a311c (patch) | |
tree | 9a8e690b486f774f51124ebb0bcee28fa8cce044 | |
parent | 38131fe2f50ba7d576d6dcde30f84d78a1009c6f (diff) |
Fix deprecation of the Py_TRASHCAN_SAFE_BEGIN/END macros
Replace by Py_TRASHCAN_BEGIN/END as introduced in 3.10.
Task-number: PYSIDE-1960
Change-Id: I17aaa2e9fa9c44f8c1004fc8dba8b22932ea44d0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 03928069a6781a1849245e6219f9caa64093068e)
-rw-r--r-- | sources/shiboken2/libshiboken/basewrapper.cpp | 8 | ||||
-rw-r--r-- | sources/shiboken2/libshiboken/sbkenum.cpp | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp index 9fbf64ecc..6fe665e39 100644 --- a/sources/shiboken2/libshiboken/basewrapper.cpp +++ b/sources/shiboken2/libshiboken/basewrapper.cpp @@ -503,7 +503,11 @@ void SbkObjectTypeDealloc(PyObject *pyObj) PyObject_GC_UnTrack(pyObj); #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_BEGIN(pyObj, 1); +# else Py_TRASHCAN_SAFE_BEGIN(pyObj); +# endif #endif if (sotp) { if (sotp->user_data && sotp->d_func) { @@ -518,7 +522,11 @@ void SbkObjectTypeDealloc(PyObject *pyObj) sotp = nullptr; } #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_END; +# else Py_TRASHCAN_SAFE_END(pyObj); +# endif #endif if (PepRuntime_38_flag) { // PYSIDE-939: Handling references correctly. diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp index 64b0edf89..1b9628435 100644 --- a/sources/shiboken2/libshiboken/sbkenum.cpp +++ b/sources/shiboken2/libshiboken/sbkenum.cpp @@ -312,13 +312,21 @@ void SbkEnumTypeDealloc(PyObject *pyObj) PyObject_GC_UnTrack(pyObj); #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_BEGIN(pyObj, 1); +# else Py_TRASHCAN_SAFE_BEGIN(pyObj); +# endif #endif if (PepType_SETP(sbkType)->converter) { Shiboken::Conversions::deleteConverter(PepType_SETP(sbkType)->converter); } #ifndef Py_LIMITED_API +# if PY_VERSION_HEX >= 0x030A0000 + Py_TRASHCAN_END; +# else Py_TRASHCAN_SAFE_END(pyObj); +# endif #endif if (PepRuntime_38_flag) { // PYSIDE-939: Handling references correctly. |