mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.
This commit is contained in:
parent
983b1434bd
commit
6b4883dec0
21 changed files with 689 additions and 454 deletions
12
Lib/_pyio.py
12
Lib/_pyio.py
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue