Open luipugs opened 8 years ago
A Boolean value is retrieved as unicode from QSettings' storage. The line https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L983 compares the type to basestring, which then returns False so the type is not munged, which causes https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L994 to become bool(u'value') and always return True. Changing the comparison to issubclass(vt, basestring) worked in my case.
unicode
basestring
False
bool(u'value')
True
issubclass(vt, basestring)
$ python Python 2.7.12 (default, Jul 1 2016, 15:12:24) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from PyQt5.QtCore import QT_VERSION_STR >>> print QT_VERSION_STR 5.5.1 >>> from PyQt5.Qt import PYQT_VERSION_STR >>> print PYQT_VERSION_STR 5.5.1 >>> from sip import SIP_VERSION_STR >>> print SIP_VERSION_STR 4.17 $ lsb_release -a LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS Release: 16.04 Codename: xenial
A Boolean value is retrieved as
unicode
from QSettings' storage. The line https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L983 compares the type tobasestring
, which then returnsFalse
so the type is not munged, which causes https://github.com/mfitzp/pyqtconfig/blob/master/pyqtconfig/config.py#L994 to becomebool(u'value')
and always returnTrue
. Changing the comparison toissubclass(vt, basestring)
worked in my case.