[PyQt] PyQt v4.5.2 QVariant woes
phil at riverbankcomputing.com
Mon Jul 20 12:26:37 BST 2009
On Sun, 19 Jul 2009 18:35:24 +0200, "Hans-Peter Jansen" <hpj at urpla.net>
> Hi Phil,
> after updating to 4.5.2, I suffer from a new issue, which is rather
> According to the changelog, you modified QVariant to not accept None
> anymore, but would accept None directly, where a QVariant is expected.
> is unfortunate, since it breaks my code, but anyway, the second term does
> not apply to QSettings.value() at least:
>>>> from PyQt4 import QtCore
>>>> settings = QtCore.QSettings()
>>>> settings.value("xxx", None)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> TypeError: argument 2 of QSettings.value() has an invalid type
> probably due to the const'ness of the 2nd QVariant.
> Is there any grave technical reason to not support the QVariant(None)
> anymore? I was so convenient to use a special cased None and and having a
> way to differentiate it with say, empty strings, empty somethings...
Both issues should be fixed in *current* SIP and PyQt snapshots.
The behaviour is slightly different. Before, None was wrapped as a valid
QVariant which was unwrapped by toPyObject(). Now, None is converted to an
invalid QVariant which is converted back to None by toPyObject(). Hopefully
you won't notice the difference.
If you can confirm you have no remaining problems I'll make a new release
in a day or two.
More information about the PyQt