From 43605e6bfa8d49612df4a38460d063d6ba781906 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Wed, 15 Nov 2017 17:14:28 -0500 Subject: bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409 --- Lib/asyncio/streams.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Lib/asyncio/streams.py') diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 9fda853768..30b751e989 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -35,6 +35,9 @@ class IncompleteReadError(EOFError): self.partial = partial self.expected = expected + def __reduce__(self): + return type(self), (self.partial, self.expected) + class LimitOverrunError(Exception): """Reached the buffer limit while looking for a separator. @@ -46,6 +49,9 @@ class LimitOverrunError(Exception): super().__init__(message) self.consumed = consumed + def __reduce__(self): + return type(self), (self.args[0], self.consumed) + @coroutine def open_connection(host=None, port=None, *, -- cgit v1.2.1