From b243da087c17241f36217684b43ba917ff56f7aa Mon Sep 17 00:00:00 2001 From: David Wilson Date: Mon, 12 Mar 2018 20:56:30 +0545 Subject: [PATCH] issue #121: fix call_function_test by not raising the dead A first small mea culpa to all my testing sins of late :) --- mitogen/core.py | 4 ++-- mitogen/master.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mitogen/core.py b/mitogen/core.py index ec58a11d..e78bb0ac 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -294,7 +294,7 @@ class Message(object): self.pickled(obj, dst_id=self.src_id, **kwargs) ) - def unpickle(self, throw=True): + def unpickle(self, throw=True, throw_dead=True): """Deserialize `data` into an object.""" _vv and IOLOG.debug('%r.unpickle()', self) fp = cStringIO.StringIO(self.data) @@ -308,7 +308,7 @@ class Message(object): raise StreamError('invalid message: %s', ex) if throw: - if obj == _DEAD: + if obj == _DEAD and throw_dead: raise ChannelError(ChannelError.remote_msg) if isinstance(obj, CallError): raise obj diff --git a/mitogen/master.py b/mitogen/master.py index 9eae6de5..7b007385 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -609,7 +609,8 @@ class Context(mitogen.core.Context): ) def call(self, fn, *args, **kwargs): - return self.call_async(fn, *args, **kwargs).get().unpickle() + receiver = self.call_async(fn, *args, **kwargs) + return receiver.get().unpickle(throw_dead=False) class Router(mitogen.parent.Router):