From 16357c822eff14ff3bfe1b6f4dcf445c407d8b2f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 13 Oct 2023 15:18:34 +0200 Subject: Fix crash when running a limited API build of 3.9 in 3.12 The size of propertyobject as needed as basic size of PyClassProperty_spec needs to be adapted according to runtime version. Otherwise, PyType_FromSpecWithBases fails with: TypeError: tp_basicsize for type 'PySide6.QtCore.PyClassProperty' (56) is too small for base 'property' (64) Pick-to: 6.6 6.5 Task-number: PYSIDE-2230 Change-Id: I03788edbb7031577f37db0fb2eb029b41f37c5f1 Reviewed-by: Shyamnath Premnadh --- sources/pyside6/libpyside/class_property.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sources/pyside6/libpyside/class_property.cpp') diff --git a/sources/pyside6/libpyside/class_property.cpp b/sources/pyside6/libpyside/class_property.cpp index 02e061277..39f536061 100644 --- a/sources/pyside6/libpyside/class_property.cpp +++ b/sources/pyside6/libpyside/class_property.cpp @@ -68,6 +68,8 @@ PyTypeObject *PyClassProperty_TypeF() if (type == nullptr) { // Provide the same `tp_getset`, which is not inherited. PyClassProperty_slots[0].pfunc = PyProperty_Type.tp_getset; + if (_PepRuntimeVersion() >= 0x030A00) + PyClassProperty_spec.basicsize = sizeof(propertyobject310); type = SbkType_FromSpec(&PyClassProperty_spec); } return type; -- cgit v1.2.3