Skip to content

Commit b039c62

Browse files
committed
use imperative style
1 parent aa99397 commit b039c62

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Doc/library/importlib.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,12 @@ ABC hierarchy::
421421
:attr:`__file__` attribute or an item from a package's
422422
:attr:`__path__` attribute.
423423

424-
If the *path* cannot be handled, this raises an :exc:`OSError`
425-
or a :exc:`ValueError` depending on the reason.
424+
If the *path* cannot be handled, either :exc:`OSError` or :exc:`ValueError`
425+
is to be raised. In most cases, these will be raised by the underlying
426+
operating system interfaces rather than directly (e.g., :exc:`OSError`
427+
would be raised when attempting to access a valid but nonexistent
428+
filesystem path, while attempting to access a path containing a NULL
429+
byte would raise :exc:`ValueError`).
426430

427431
.. versionchanged:: 3.4
428432
Raise :exc:`OSError` by default instead of :exc:`NotImplementedError`.
@@ -588,8 +592,10 @@ ABC hierarchy::
588592
- ``'size'`` (optional): the size in bytes of the source code.
589593

590594
Any other keys in the dictionary are ignored, to allow for future
591-
extensions. If the *path* cannot be handled, this raises an
592-
:exc:`OSError` or a :exc:`ValueError` depending on the reason.
595+
extensions.
596+
597+
As for :meth:`ResourecLoader.get_data`, either :exc:`OSError` or
598+
:exc:`ValueError` is to be raised if the *path* cannot be handled.
593599

594600
.. versionadded:: 3.3
595601

@@ -604,8 +610,7 @@ ABC hierarchy::
604610
.. deprecated:: 3.3
605611
This method is deprecated in favour of :meth:`path_stats`. You don't
606612
have to implement it, but it is still available for compatibility
607-
purposes. If the *path* cannot be handled, this raises an
608-
:exc:`OSError` or a :exc:`ValueError` depending on the reason.
613+
purposes.
609614

610615
.. versionchanged:: 3.4
611616
Raise :exc:`OSError` by default instead of :exc:`NotImplementedError`.

0 commit comments

Comments
 (0)