bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409

This commit is contained in:
Yury Selivanov 2017-11-15 17:14:28 -05:00 committed by GitHub
parent 4bd41c9b52
commit 43605e6bfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View file

@ -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, *,