From a37ccabd91ac9a1aea3c12f9ac72a66f562d9b54 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 4 May 2018 23:38:48 +0100 Subject: [PATCH] core: wrapper functions provide no protection in this case --- mitogen/core.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index a3d13353..8ba811a8 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -118,7 +118,7 @@ class Blob(BytesType): return '[blob: %d bytes]' % len(self) def __reduce__(self): - return (_unpickle_blob, (BytesType(self),)) + return (Blob, (BytesType(self),)) class Secret(UnicodeType): @@ -129,7 +129,7 @@ class Secret(UnicodeType): return UnicodeType(self) def __reduce__(self): - return (_unpickle_secret, (UnicodeType(self),)) + return (Secret, (UnicodeType(self),)) class CallError(Error): @@ -150,14 +150,6 @@ class CallError(Error): return (_unpickle_call_error, (self[0],)) -def _unpickle_blob(s): - return Blob(s) - - -def _unpickle_secret(s): - return Secret(s) - - def _unpickle_call_error(s): if not (type(s) is str and len(s) < 10000): raise TypeError('cannot unpickle CallError: bad input') @@ -341,10 +333,10 @@ class Message(object): return self._unpickle_sender elif func == '_unpickle_context': return self._unpickle_context - elif func == '_unpickle_blob': - return _unpickle_blob - elif func == '_unpickle_secret': - return _unpickle_secret + elif func == 'Blob': + return Blob + elif func == 'Secret': + return Secret raise StreamError('cannot unpickle %r/%r', module, func) @property