diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-10-13 15:18:34 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-13 17:27:55 +0000 |
commit | 6daa769b6f283427eaa1630af808c586867f95dd (patch) | |
tree | 97a7a2191ccdd0950eb9938ce25efe9403261bf4 | |
parent | 9d3ee797a2ea6f5781f8b2b16922e21bdb2d3b26 (diff) |
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)
Task-number: PYSIDE-2230
Change-Id: I03788edbb7031577f37db0fb2eb029b41f37c5f1
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 16357c822eff14ff3bfe1b6f4dcf445c407d8b2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ab3125f6147e9b6a741850ee470ffcec76bfe5b1)
-rw-r--r-- | sources/pyside6/libpyside/class_property.cpp | 2 | ||||
-rw-r--r-- | sources/pyside6/libpyside/class_property.h | 11 |
2 files changed, 11 insertions, 2 deletions
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; diff --git a/sources/pyside6/libpyside/class_property.h b/sources/pyside6/libpyside/class_property.h index a3125b169..4942e0ef3 100644 --- a/sources/pyside6/libpyside/class_property.h +++ b/sources/pyside6/libpyside/class_property.h @@ -15,11 +15,18 @@ struct propertyobject { PyObject *prop_set; PyObject *prop_del; PyObject *prop_doc; -#if PY_VERSION_HEX >= 0x030A0000 + int getter_doc; +}; + +struct propertyobject310 { + PyObject_HEAD + PyObject *prop_get; + PyObject *prop_set; + PyObject *prop_del; + PyObject *prop_doc; // Note: This is a problem with Limited API: We have no direct access. // You need to pick it from runtime info. PyObject *prop_name; -#endif int getter_doc; }; |