]> granicus.if.org Git - python/commitdiff
Get rid of deprecated IOError in the doc
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 31 Mar 2014 22:13:30 +0000 (01:13 +0300)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 31 Mar 2014 22:13:30 +0000 (01:13 +0300)
Doc/c-api/exceptions.rst
Doc/howto/unicode.rst
Doc/library/importlib.rst
Doc/tutorial/controlflow.rst
Doc/tutorial/errors.rst

index 6fda191d2f42d4c374f207f44ba9beb57f9519d5..33b44390d24ca20d301e8e06f50b9b9e5767cb02 100644 (file)
@@ -236,8 +236,8 @@ in various ways.  There is a separate error indicator for each thread.
 
    Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that if
    *filenameObject* is not *NULL*, it is passed to the constructor of *type* as
-   a third parameter.  In the case of exceptions such as :exc:`IOError` and
-   :exc:`OSError`, this is used to define the :attr:`filename` attribute of the
+   a third parameter.  In the case of :exc:`OSError` exception,
+   this is used to define the :attr:`filename` attribute of the
    exception instance.
 
 
index 9d48a787e85dd6b995c171a01c755372506f12d4..87badf33e3d29e78103489e38015fe2edcd555c2 100644 (file)
@@ -246,7 +246,7 @@ include a Unicode character in a string literal::
    try:
        with open('/tmp/input.txt', 'r') as f:
            ...
-   except IOError:
+   except OSError:
        # 'File not found' error message.
        print("Fichier non trouvĂ©")
 
index f3b206311a130ce6d871163e2f40cfcaeda202f4..afdae9e0f0e6c2fe09cc8e68d8ce82a822306d42 100644 (file)
@@ -449,12 +449,12 @@ ABC hierarchy::
         Loaders that have a file-like storage back-end
         that allows storing arbitrary data
         can implement this abstract method to give direct access
-        to the data stored. :exc:`IOError` is to be raised if the *path* cannot
+        to the data stored. :exc:`OSError` is to be raised if the *path* cannot
         be found. The *path* is expected to be constructed using a module's
         :attr:`__file__` attribute or an item from a package's :attr:`__path__`.
 
         .. versionchanged:: 3.4
-           Raises :exc:`IOError` instead of :exc:`NotImplementedError`.
+           Raises :exc:`OSError` instead of :exc:`NotImplementedError`.
 
 
 .. class:: InspectLoader
@@ -609,12 +609,12 @@ ABC hierarchy::
         - ``'size'`` (optional): the size in bytes of the source code.
 
         Any other keys in the dictionary are ignored, to allow for future
-        extensions. If the path cannot be handled, :exc:`IOError` is raised.
+        extensions. If the path cannot be handled, :exc:`OSError` is raised.
 
         .. versionadded:: 3.3
 
         .. versionchanged:: 3.4
-           Raise :exc:`IOError` instead of :exc:`NotImplementedError`.
+           Raise :exc:`OSError` instead of :exc:`NotImplementedError`.
 
     .. method:: path_mtime(path)
 
@@ -624,10 +624,10 @@ ABC hierarchy::
         .. deprecated:: 3.3
            This method is deprecated in favour of :meth:`path_stats`.  You don't
            have to implement it, but it is still available for compatibility
-           purposes. Raise :exc:`IOError` if the path cannot be handled.
+           purposes. Raise :exc:`OSError` if the path cannot be handled.
 
         .. versionchanged:: 3.4
-           Raise :exc:`IOError` instead of :exc:`NotImplementedError`.
+           Raise :exc:`OSError` instead of :exc:`NotImplementedError`.
 
     .. method:: set_data(path, data)
 
index 97aea4fbcc4a8857a7d9d211c232bcafe04cd4a6..ef50731a5b69f428595917f7eb5b627600facfb4 100644 (file)
@@ -370,7 +370,7 @@ defined to allow.  For example::
                return False
            retries = retries - 1
            if retries < 0:
-               raise IOError('uncooperative user')
+               raise OSError('uncooperative user')
            print(complaint)
 
 This function can be called in several ways:
index 4282151589a0d0b44a851e4c39116649142fa5ab..d048ae9e1090db6a3e04b31050ae2082bcce1aa9 100644 (file)
@@ -131,8 +131,8 @@ the exception (allowing a caller to handle the exception as well)::
        f = open('myfile.txt')
        s = f.readline()
        i = int(s.strip())
-   except IOError as err:
-       print("I/O error: {0}".format(err))
+   except OSError as err:
+       print("OS error: {0}".format(err))
    except ValueError:
        print("Could not convert data to an integer.")
    except: