Mapping EBADF is not very useful (as pointed out by Nick)

This commit is contained in:
Antoine Pitrou 2011-07-27 00:43:27 +02:00
parent 84dda3bb67
commit 089008558c
1 changed files with 3 additions and 8 deletions

View File

@ -335,14 +335,14 @@ Prerequisite
`Step 1`_ is a loose prerequisite for this. `Step 1`_ is a loose prerequisite for this.
Prerequisite, because some errnos can currently be attached to different Prerequisite, because some errnos can currently be attached to different
exception classes: for example, EBADF can be attached to both OSError and exception classes: for example, ENOENT can be attached to both OSError and
IOError, depending on the context. If we don't want to break *useful IOError, depending on the context. If we don't want to break *useful
compatibility*, we can't make an ``except OSError`` (or IOError) fail to compatibility*, we can't make an ``except OSError`` (or IOError) fail to
match an exception where it would succeed today. match an exception where it would succeed today.
Loose, because we could decide for a partial resolution of step 2 Loose, because we could decide for a partial resolution of step 2
if existing exception classes are not coalesced: for example, EBADF could if existing exception classes are not coalesced: for example, ENOENT could
raise a hypothetical BadFileDescriptor where an IOError was previously raise a hypothetical FileNotFoundError where an IOError was previously
raised, but continue to raise OSError otherwise. raised, but continue to raise OSError otherwise.
The dependency on step 1 could be totally removed if the new subclasses The dependency on step 1 could be totally removed if the new subclasses
@ -376,10 +376,6 @@ the list of errnos mapped to them, is submitted to discussion:
for non-blocking operation (EAGAIN, EALREADY, EWOULDBLOCK, EINPROGRESS); for non-blocking operation (EAGAIN, EALREADY, EWOULDBLOCK, EINPROGRESS);
this is the existing ``io.BlockingIOError`` with an extended role this is the existing ``io.BlockingIOError`` with an extended role
* ``FileDescriptorError``: operation on an invalid file descriptor (EBADF);
the default error message could point out that most causes are that
an existing file descriptor has been closed
* ``ConnectionAbortedError``: connection attempt aborted by peer (ECONNABORTED) * ``ConnectionAbortedError``: connection attempt aborted by peer (ECONNABORTED)
* ``ConnectionRefusedError``: connection reset by peer (ECONNREFUSED) * ``ConnectionRefusedError``: connection reset by peer (ECONNREFUSED)
@ -408,7 +404,6 @@ shown::
+-- ConnectionAbortedError ECONNABORTED +-- ConnectionAbortedError ECONNABORTED
+-- ConnectionRefusedError ECONNREFUSED +-- ConnectionRefusedError ECONNREFUSED
+-- ConnectionResetError ECONNRESET +-- ConnectionResetError ECONNRESET
+-- FileDescriptorError EBADF
+-- FileSystemError +-- FileSystemError
+-- FileExistsError EEXIST +-- FileExistsError EEXIST
+-- FileNotFoundError ENOENT +-- FileNotFoundError ENOENT