[Python-checkins] r83022 - sandbox/trunk/errnopep/pepXXXX.txt
antoine.pitrou
python-checkins at python.org
Wed Jul 21 15:50:26 CEST 2010
Author: antoine.pitrou
Date: Wed Jul 21 15:50:26 2010
New Revision: 83022
Log:
Fix rest code, and an example
Modified:
sandbox/trunk/errnopep/pepXXXX.txt
Modified: sandbox/trunk/errnopep/pepXXXX.txt
==============================================================================
--- sandbox/trunk/errnopep/pepXXXX.txt (original)
+++ sandbox/trunk/errnopep/pepXXXX.txt Wed Jul 21 15:50:26 2010
@@ -1,4 +1,4 @@
-PEP: XXX
+PEP: 3789
Title: Reworking the OS and IO exception hierarchy
Version: $Revision: $
Last-Modified: $Date: $
@@ -283,9 +283,9 @@
should automatically benefit from the new, finer-grained exception classes.
Library modules written in Python, though, will have to be adapted where
-they currently use the following idiom::
+they currently use the following idiom (seen in ``Lib/tempfile.py``)::
- raise OSError(errno.ENOTDIR, "execve called")
+ raise IOError(_errno.EEXIST, "No usable temporary file name found")
Fortunately, such Python code is quite rare since raising OSError or IOError
with an errno value normally happens when interfacing with system calls,
@@ -401,7 +401,7 @@
the standard library and its tests, as part of ``except`` clauses.
Common errnos with OSError
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------
* ``EBADF``: bad file descriptor (usually means the file descriptor was
closed)
@@ -422,7 +422,7 @@
* ``EPERM``: operation not permitted (when using e.g. os.setuid())
Common errnos with IOError
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+--------------------------
* ``EACCES``: permission denied (for filesystem operations)
@@ -440,7 +440,7 @@
* ``ETIMEDOUT``: connection timed out
Common errnos with socket.error
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------
All these errors may also be associated with a plain IOError, for example
when calling read() on a socket's file descriptor.
@@ -469,7 +469,7 @@
* ``EWOULDBLOCK``: same reasons as ``EAGAIN``
Common errnos with select.error
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-------------------------------
* ``EINTR``: interrupted function call
@@ -479,7 +479,7 @@
=============================================
Interpreter core
-~~~~~~~~~~~~~~~~
+----------------
Handling of PYTHONSTARTUP raises IOError (but the error gets discarded)::
@@ -496,10 +496,10 @@
Modules
-~~~~~~~
+-------
bz2
----
+~~~
Raises IOError throughout (OSError is unused)::
@@ -517,12 +517,12 @@
IOError: file is not ready for reading
curses
-------
+~~~~~~
Not examined.
dbm.gnu, dbm.ndbm
------------------
+~~~~~~~~~~~~~~~~~
_dbm.error and _gdbm.error inherit from IOError::
@@ -532,12 +532,12 @@
_gdbm.error: [Errno 2] No such file or directory
fcntl
------
+~~~~~
Raises IOError throughout (OSError is unused).
imp module
-----------
+~~~~~~~~~~
Raises IOError for bad file descriptors::
@@ -547,7 +547,7 @@
IOError: [Errno 9] Bad file descriptor
io module
----------
+~~~~~~~~~
Raises IOError when trying to open a directory under Unix::
@@ -599,12 +599,12 @@
object would block.
multiprocessing
----------------
+~~~~~~~~~~~~~~~
Not examined.
ossaudiodev
------------
+~~~~~~~~~~~
Raises IOError throughout (OSError is unused)::
@@ -614,7 +614,7 @@
IOError: [Errno 2] No such file or directory: 'foo'
readline
---------
+~~~~~~~~
Raises IOError in various file-handling functions::
@@ -632,7 +632,7 @@
IOError: [Errno 13] Permission denied
select
-------
+~~~~~~
select() and poll objects raise select.error, which doesn't inherit from
anything (but poll.modify() which raises IOError).
@@ -640,21 +640,21 @@
kqueue objects raise both OSError and IOError.
signal
-------
+~~~~~~
signal.ItimerError inherits from IOError.
socket
-------
+~~~~~~
socket.error inherits from IOError.
time
-----
+~~~~
Raises IOError for internal errors in time.time() and time.sleep().
zipimport
----------
+~~~~~~~~~
zipimporter.get_data() can raise IOError.
More information about the Python-checkins
mailing list