[PyQt] Re: PyQT lost reference (was: Re: PyKDE: KConfigSkeleton not writing configuration)

Wolfgang Rohdewald wolfgang at rohdewald.de
Fri Mar 13 10:44:57 GMT 2009

On Freitag, 13. März 2009, Till Gerken wrote:

> The QString() that I am passing as reference to the C++ class
> KCoreConfigSkeleton exists as local variable in my Python class
> derived from KCoreConfigSkeleton. Now any code that interacts with
> KCoreConfigSkeleton (C++ or Python) may change this QString instance.

this is because QString() is mutable while python strings are immutable.
When dealing with KCoreConfig, do not use QString as local variables,
always convert explicitly from/to python strings.

I wonder what happens with this when the QString will be eliminated
in PyQt4 as announced. That might break code which relies on 
QString being mutable.

See my message



More information about the PyQt mailing list