PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.

This commit is contained in:
Antoine Pitrou 2011-10-12 02:54:14 +02:00
parent 983b1434bd
commit 6b4883dec0
21 changed files with 689 additions and 454 deletions

View file

@ -23,16 +23,8 @@ DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes
# defined in io.py. We don't use real inheritance though, because we don't
# want to inherit the C implementations.
class BlockingIOError(IOError):
"""Exception raised when I/O would block on a non-blocking I/O stream."""
def __init__(self, errno, strerror, characters_written=0):
super().__init__(errno, strerror)
if not isinstance(characters_written, int):
raise TypeError("characters_written must be a integer")
self.characters_written = characters_written
# Rebind for compatibility
BlockingIOError = BlockingIOError
def open(file, mode="r", buffering=-1, encoding=None, errors=None,