cpython (merge 3.4 -> default): Merge 3.4: Get rid of deprecated IOError in the doc

http://hg.python.org/cpython/rev/f5dda52a4ccd changeset: 90083:f5dda52a4ccd parent: 90081:c0c17718301f parent: 90082:8d5f005a0da3 user: Andrew Svetlov <andrew.svetlov@gmail.com> date: Tue Apr 01 01:14:27 2014 +0300 summary: Merge 3.4: Get rid of deprecated IOError in the doc files: Doc/c-api/exceptions.rst | 4 ++-- Doc/howto/unicode.rst | 2 +- Doc/library/importlib.rst | 12 ++++++------ Doc/tutorial/controlflow.rst | 2 +- Doc/tutorial/errors.rst | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst +++ b/Doc/c-api/exceptions.rst @@ -236,8 +236,8 @@ 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. diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -246,7 +246,7 @@ try: with open('/tmp/input.txt', 'r') as f: ... - except IOError: + except OSError: # 'File not found' error message. print("Fichier non trouvé") diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -449,12 +449,12 @@ 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 @@ - ``'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 @@ .. 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) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -370,7 +370,7 @@ 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: diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -131,8 +131,8 @@ 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: -- Repository URL: http://hg.python.org/cpython
participants (1)
-
andrew.svetlov