Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 08af000

Browse files
committed
Get rid of deprecated IOError in the doc
1 parent 5898d4f commit 08af000

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

Doc/c-api/exceptions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ in various ways. There is a separate error indicator for each thread.
236236
237237
Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that if
238238
*filenameObject* is not *NULL*, it is passed to the constructor of *type* as
239-
a third parameter. In the case of exceptions such as :exc:`IOError` and
240-
:exc:`OSError`, this is used to define the :attr:`filename` attribute of the
239+
a third parameter. In the case of :exc:`OSError` exception,
240+
this is used to define the :attr:`filename` attribute of the
241241
exception instance.
242242
243243

Doc/howto/unicode.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ include a Unicode character in a string literal::
246246
try:
247247
with open('/tmp/input.txt', 'r') as f:
248248
...
249-
except IOError:
249+
except OSError:
250250
# 'File not found' error message.
251251
print("Fichier non trouvé")
252252

Doc/library/importlib.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,12 @@ ABC hierarchy::
449449
Loaders that have a file-like storage back-end
450450
that allows storing arbitrary data
451451
can implement this abstract method to give direct access
452-
to the data stored. :exc:`IOError` is to be raised if the *path* cannot
452+
to the data stored. :exc:`OSError` is to be raised if the *path* cannot
453453
be found. The *path* is expected to be constructed using a module's
454454
:attr:`__file__` attribute or an item from a package's :attr:`__path__`.
455455

456456
.. versionchanged:: 3.4
457-
Raises :exc:`IOError` instead of :exc:`NotImplementedError`.
457+
Raises :exc:`OSError` instead of :exc:`NotImplementedError`.
458458

459459

460460
.. class:: InspectLoader
@@ -609,12 +609,12 @@ ABC hierarchy::
609609
- ``'size'`` (optional): the size in bytes of the source code.
610610

611611
Any other keys in the dictionary are ignored, to allow for future
612-
extensions. If the path cannot be handled, :exc:`IOError` is raised.
612+
extensions. If the path cannot be handled, :exc:`OSError` is raised.
613613

614614
.. versionadded:: 3.3
615615

616616
.. versionchanged:: 3.4
617-
Raise :exc:`IOError` instead of :exc:`NotImplementedError`.
617+
Raise :exc:`OSError` instead of :exc:`NotImplementedError`.
618618

619619
.. method:: path_mtime(path)
620620

@@ -624,10 +624,10 @@ ABC hierarchy::
624624
.. deprecated:: 3.3
625625
This method is deprecated in favour of :meth:`path_stats`. You don't
626626
have to implement it, but it is still available for compatibility
627-
purposes. Raise :exc:`IOError` if the path cannot be handled.
627+
purposes. Raise :exc:`OSError` if the path cannot be handled.
628628

629629
.. versionchanged:: 3.4
630-
Raise :exc:`IOError` instead of :exc:`NotImplementedError`.
630+
Raise :exc:`OSError` instead of :exc:`NotImplementedError`.
631631

632632
.. method:: set_data(path, data)
633633

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ defined to allow. For example::
370370
return False
371371
retries = retries - 1
372372
if retries < 0:
373-
raise IOError('uncooperative user')
373+
raise OSError('uncooperative user')
374374
print(complaint)
375375

376376
This function can be called in several ways:

Doc/tutorial/errors.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ the exception (allowing a caller to handle the exception as well)::
131131
f = open('myfile.txt')
132132
s = f.readline()
133133
i = int(s.strip())
134-
except IOError as err:
135-
print("I/O error: {0}".format(err))
134+
except OSError as err:
135+
print("OS error: {0}".format(err))
136136
except ValueError:
137137
print("Could not convert data to an integer.")
138138
except:

0 commit comments

Comments
 (0)