More robust fix for handling of .py config files with pickled QByteArray instances

This commit is contained in:
Kovid Goyal 2014-04-22 16:04:33 +05:30
parent 4106a4b0d1
commit 69af8a9b65

View File

@ -193,16 +193,12 @@ class OptionSet(object):
try: try:
if not isinstance(src, unicode): if not isinstance(src, unicode):
src = src.decode('utf-8') src = src.decode('utf-8')
src = src.replace(u'PyQt5.QtCore', u'PyQt4.QtCore') src = src.replace(u'PyQt4.QtCore', u'PyQt5.QtCore')
exec src in options exec src in options
except (SystemError, RuntimeError): except:
try: print 'Failed to parse options string:'
src = src.replace('PyQt' + '4', 'PyQt5') print repr(src)
exec src in options traceback.print_exc()
except:
print 'Failed to parse options string:'
print repr(src)
traceback.print_exc()
opts = OptionValues() opts = OptionValues()
for pref in self.preferences: for pref in self.preferences:
val = options.get(pref.name, pref.default) val = options.get(pref.name, pref.default)