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

Loading…
Cancel
Save