Also ignore unserializable settings when migrating pickle files

This commit is contained in:
Kovid Goyal 2019-04-15 08:58:31 +05:30
parent 7f4ca92b5a
commit d0d609c715
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -203,8 +203,7 @@ class DynamicConfig(dict):
'''
A replacement for QSettings that supports dynamic config keys.
Returns `None` if a config key is not found. Note that the config
data is stored in a non human readable pickle file, so only use this
class for preferences that you don't intend to have the users edit directly.
data is stored in a JSON file.
'''
def __init__(self, name='dynamic'):
@ -257,7 +256,7 @@ class DynamicConfig(dict):
d = self.read_old_serialized_representation()
migrate = bool(d)
if migrate and d:
raw = json_dumps(d)
raw = json_dumps(d, ignore_unserializable=True)
with ExclusiveFile(self.file_path) as f:
f.seek(0), f.truncate()
f.write(raw)