From 5829cbbf60529448e63e5b7103a007d08d9387d8 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 10 Jul 2018 12:27:15 +0200 Subject: 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 --- sources/shiboken2/libshiboken/sbkenum.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sources/shiboken2/libshiboken/sbkenum.cpp') diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp index 5f753293c..119591215 100644 --- a/sources/shiboken2/libshiboken/sbkenum.cpp +++ b/sources/shiboken2/libshiboken/sbkenum.cpp @@ -312,11 +312,15 @@ void SbkEnumTypeDealloc(PyObject* pyObj) SbkEnumType* sbkType = reinterpret_cast(pyObj); PyObject_GC_UnTrack(pyObj); +#ifndef Py_LIMITED_API Py_TRASHCAN_SAFE_BEGIN(pyObj); +#endif if (PepType_SETP(sbkType)->converter) { Shiboken::Conversions::deleteConverter(PepType_SETP(sbkType)->converter); } +#ifndef Py_LIMITED_API Py_TRASHCAN_SAFE_END(pyObj); +#endif } PyObject* SbkEnumTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds) -- cgit v1.2.3