enable SimpleNamespace for unpickling

pull/953/head
James O'Beirne 3 years ago
parent 8cda5f5537
commit 77fc745350

@ -151,12 +151,14 @@ if PY3:
FsPathTypes = (str,)
BufferType = lambda buf, start: memoryview(buf)[start:]
long = int
from types import SimpleNamespace
else:
b = str
BytesType = str
FsPathTypes = (str, unicode)
BufferType = buffer
UnicodeType = unicode
SimpleNamespace = None
AnyTextType = (BytesType, UnicodeType)
@ -864,6 +866,8 @@ class Message(object):
return self._unpickle_bytes
elif module == '__builtin__' and func == 'bytes':
return BytesType
elif SimpleNamespace and module == 'types' and func == 'SimpleNamespace':
return SimpleNamespace
raise StreamError('cannot unpickle %r/%r', module, func)
@property

Loading…
Cancel
Save