[PyQt] sip: Accessing members results in incorrect/missing data
MatthijsBurgh
MatthijsBurgh at outlook.com
Thu Jan 16 20:52:36 GMT 2020
I have done some more investigating.
As mentioned https://github.com/orocos/orocos_kinematics_dynamics/issues/41,
problems where occuring in with SIP 4.13.2.
Which is explainable as you fixed this issue in the commit:
https://www.riverbankcomputing.com/hg/sip/rev/0dd3cb4eff0e. This makes sure
the member variable contains a reference to the containing class. This
prevents the class from being garbage collected while there are still
references to the member variable.
You apply a fix to this in commit
https://www.riverbankcomputing.com/hg/sip/rev/fbb9cdbad791.
The commit, https://www.riverbankcomputing.com/hg/sip/rev/11a92ebd4840,
which I also mentioned in my first message, is the important one.
In this commit you introduce a kind of caching for member variables. The
python wrapper of the members of a class are stored in a dict in the python
wrapper of the class. To add the member to the cache, you use
"sipKeepReference(sipPySelf, %d, sipPy)". So the class contains a reference
to the member variable.
While previously "sipKeepReference(sipPy, -1, sipPySelf)", was used to store
the reference to the class in the dict of the member variable. Focus here on
the switch of "sipPy" and "sipPySelf". So by the last commit, 11a92ebd4840,
you added a new feature, but you broke another one.
I suggest to restore the feature which stores the reference to the class in
the member variable dict.
I did some testing in 4.19.20. I didn't experience a significant performance
increase with the caching with my Frame object and its member p, a vector
with 3 variables. (I tweaked the code,
https://www.riverbankcomputing.com/hg/sip/file/7c54145e55b6/sipgen/gencode.c#l4904,
to always get the caching.)
Also I added manually the "sipKeepReference(sipPy, -1, sipPySelf)" to the
generated cpp for the class reference. When both features were used at the
same time, the "release" function of the class was not called. (I added a
"printf" to it, which didn't show in that situation, but did if just of the
two was used.)
I hope you are still willing to help with this issue.
The library is open-source and mostly community-driven in the last few years
as the maintaining this library is not related to the maintainers daily job.
So the maintainer is not able to put in as much time to fix this problem as
I can.
Matthijs
--
Sent from: http://python.6.x6.nabble.com/PyQt-f1792048.html
More information about the PyQt
mailing list