bump pickle proto to v4; change column type to blob

This commit is contained in:
Damien Elmes 2020-12-16 15:31:24 +10:00
parent 4b04905ff8
commit 17a221dfa0

View file

@ -240,8 +240,8 @@ class ProfileManager:
up = Unpickler(io.BytesIO(data), errors="ignore") up = Unpickler(io.BytesIO(data), errors="ignore")
return up.load() return up.load()
def _pickle(self, obj) -> Any: def _pickle(self, obj) -> bytes:
return pickle.dumps(obj, protocol=0) return pickle.dumps(obj, protocol=4)
def load(self, name) -> bool: def load(self, name) -> bool:
assert name != "_global" assert name != "_global"
@ -433,7 +433,7 @@ class ProfileManager:
self.db.execute( self.db.execute(
""" """
create table if not exists profiles create table if not exists profiles
(name text primary key, data text not null);""" (name text primary key, data blob not null);"""
) )
data = self.db.scalar( data = self.db.scalar(
"select cast(data as blob) from profiles where name = '_global'" "select cast(data as blob) from profiles where name = '_global'"