Details
Description
QtCore.Property was developed around 2012 and never really updated.
Python's property implementation changed 2013 like this:
class TestClass: def __init__(self): self._data = None @property def thing(self): return self._data @thing.setter def thing(self, value): # Would not work with another name self._data = value
The property implementation was changed so that every changing action on a property
now creates a full copy of the property object. This has the side effect that properties with
different setter names no longer work, because the property object would be missed.
PyQt5 already has an almost correct implementation of QtCore.pyqtProperty, just __doc__ is not writable.
With the supplied patch, PySide2's property implementation is completely correct, but has one inherent problem left:
QtCore.Property does work with QObject derived classes, only, while PyQt5
does not need that. This is a curiosity of our property implementation which does not use the usual tp_descr_get/tp_descr_set slots and therefore needs further investigation.
Attachments
Issue Links
- relates to
-
PYSIDE-2453 garbage collection fails when using QtCore.Property
- Reported
For Gerrit Dashboard: PYSIDE-1402 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
315628,17 | Update QtCore.Property to the current standard | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
317117,2 | property_python_test.py: Restrict except | 5.15 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
398633,3 | Add explanatory comment to PySideProperty | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
398847,2 | Add explanatory comment to PySideProperty | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
461172,3 | debug: fix refcount of disassembleFrame | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
461174,3 | property: fix an old refcount bug, concluding debug errors | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
461222,4 | property: fix an old refcount bug, concluding debug errors | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
461386,3 | debug: fix refcount of disassembleFrame | 6.4 | pyside/pyside-setup | Status: MERGED | +2 | 0 |