jsondb: raise when trying to store sets in the db
Some generic protection to prevent bugs similar to what was just fixed in prev commits. related https://github.com/spesmilo/electrum/issues/8842
This commit is contained in:
@@ -159,6 +159,9 @@ class StoredDict(dict):
|
||||
# convert lists
|
||||
if isinstance(v, list):
|
||||
v = StoredList(v, self.db, self.path + [key])
|
||||
# reject sets. they do not work well with jsonpatch
|
||||
if isinstance(v, set):
|
||||
raise Exception(f"Do not store sets inside jsondb. path={self.path!r}")
|
||||
# set item
|
||||
dict.__setitem__(self, key, v)
|
||||
if self.db and patch:
|
||||
|
||||
Reference in New Issue
Block a user