diff options
| author | Christian Tismer <tismer@stackless.com> | 2022-12-02 13:47:48 +0100 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2022-12-13 11:26:19 +0100 |
| commit | e20e29d1bd03f6ff9e57037d0a7f35bb59604f4e (patch) | |
| tree | 3031f8f9b89879fd27950e63a346651338058ba1 /sources/pyside6/libpyside/pysideqobject.h | |
| parent | d09302d50bf64afdf7eae0075134bb554c9d1166 (diff) | |
__feature__: Fix a weird case of false metafunction lookup
PySide implements duck-punching since 2010.
This could create a problem with true_property since 06/2019, because a
meta-function could be found in the instance dict of a QObject class,
although the methods were replaced by a property object.
This was an unexpected reaction of the `getMetaDataFromQObject`
function. Meta methods were created and inserted into the instance
dict, which caused very unrelated side effects like infinite recursion.
The new implementation handles Python properties correctly and looks
up the hidden methods if necessary without side effects.
There are no longer meta functions involved.
The function `getMetaDataFromQObject` is misleading and was replaced
by `getHiddenDataFromQObject`, keeping the old name as an alias.
It will be finally removed in version 6.5 .
[ChangeLog][PySide6] A callback error when using true_property was fixed.
Change-Id: Ie5234eab2106885f6edad24ae7d4c55fff43d62f
Fixes: PYSIDE-1889
Pick-to: 6.4
Task-number: PYSIDE-1019
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysideqobject.h')
| -rw-r--r-- | sources/pyside6/libpyside/pysideqobject.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/pyside6/libpyside/pysideqobject.h b/sources/pyside6/libpyside/pysideqobject.h index 96834635d..30dad6e97 100644 --- a/sources/pyside6/libpyside/pysideqobject.h +++ b/sources/pyside6/libpyside/pysideqobject.h @@ -40,12 +40,15 @@ PYSIDE_API bool isQObjectDerived(PyTypeObject *pyType, bool raiseError); /// Convenience to convert a PyObject to QObject PYSIDE_API QObject *convertToQObject(PyObject *object, bool raiseError); -/// Check for properties and signals registered on MetaObject and return these +/// Check for properties and signals registered on MetaObject and return these. +/// Also handle Python properties when true_property was selected. /// \param cppSelf Is the QObject which contains the metaobject /// \param self Python object of cppSelf /// \param name Name of the argument which the function will try retrieve from MetaData /// \return The Python object which contains the Data obtained in metaObject or the Python -/// attribute related with name +/// method pulled out of a Python property. +PYSIDE_API PyObject *getHiddenDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *name); +/// This is an alias, meanwhile misleading: PYSIDE_API PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *name); /// Mutex for accessing QObject memory helpers from multiple threads |
