Fix AttributeError in mitogen.core.Context.send_await()

As of adc8fe3aed Receiver objects do not
have a get_data() method and Receiver.get() does not unpickle the
message.
This commit is contained in:
Alex Willmer 2018-02-14 23:27:54 +00:00
parent 8121530144
commit c1e29783fb
1 changed files with 4 additions and 3 deletions

View File

@ -772,9 +772,10 @@ class Context(object):
def send_await(self, msg, deadline=None):
"""Send `msg` and wait for a response with an optional timeout."""
receiver = self.send_async(msg)
response = receiver.get_data(deadline)
IOLOG.debug('%r._send_await() -> %r', self, response)
return response
response = receiver.get(deadline)
data = response.unpickle()
IOLOG.debug('%r._send_await() -> %r', self, data)
return data
def __repr__(self):
return 'Context(%s, %r)' % (self.context_id, self.name)