1
0

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:
SomberNight
2024-01-23 01:49:04 +00:00
parent 79aba5364c
commit 1734042293

View File

@@ -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: