aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/basewrapper.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2018-07-10 12:27:15 +0200
committerChristian Tismer <tismer@stackless.com>2018-07-10 15:28:33 +0000
commit5829cbbf60529448e63e5b7103a007d08d9387d8 (patch)
treee7c38c04384ce3f1163172878d83a32f1b5bfb8a /sources/shiboken2/libshiboken/basewrapper.cpp
parent264e0ec580dcca0366aa0e79da11cf38893c4a2f (diff)
Fix limited API incompatibility with Python 3.7
When Python 3.7 appeared, the structure of pystate.h was changed, substantially. Unfortunately this structure contains the trashcan code, which is only available as a macro and not part of the limited API. This code is normally not used by application programs. It prevents crashes when chains of millions of objects are deallocated. I disabled this for now when the limited API is active. As soon as somebody complains about crashes, I will try to implement it again in a safe way, but I am not sure if it is worth it in the first place. Task-number: PYSIDE-737 Change-Id: Id0daf391448ddcb9df3d299f859ef024714fa736 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken2/libshiboken/basewrapper.cpp')
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index ae6b2a68a..122e60e41 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -259,7 +259,9 @@ void SbkObjectTypeDealloc(PyObject* pyObj)
PyTypeObject *type = reinterpret_cast<PyTypeObject*>(pyObj);
PyObject_GC_UnTrack(pyObj);
+#ifndef Py_LIMITED_API
Py_TRASHCAN_SAFE_BEGIN(pyObj);
+#endif
if (sotp) {
if (sotp->user_data && sotp->d_func) {
sotp->d_func(sotp->user_data);
@@ -272,7 +274,9 @@ void SbkObjectTypeDealloc(PyObject* pyObj)
delete sotp;
sotp = nullptr;
}
+#ifndef Py_LIMITED_API
Py_TRASHCAN_SAFE_END(pyObj);
+#endif
}
PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds)