pickle: Module produces and consumes bytes.

So, dumps() should return bytes, dump() should be passed binary file, etc.
pull/255/head
Paul Sokolovsky 2018-01-21 14:49:24 +02:00
rodzic 66f147a761
commit 22527a6ebd
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -4,7 +4,7 @@ def dump(obj, f, proto=0):
f.write(repr(obj))
def dumps(obj, proto=0):
return repr(obj)
return repr(obj).encode()
def load(f):
s = f.read()
@ -12,6 +12,7 @@ def load(f):
def loads(s):
d = {}
s = s.decode()
if "(" in s:
qualname = s.split("(", 1)[0]
if "." in qualname: