Skip to content

Commit d3f839d

Browse files
author
Chester Li
committed
Address review: move exceptions to Archiving operations section
- Move ReadError docs near unpack_archive() - Move RegistryError docs near register_unpack_format() - Add note that register_unpack_format() raises RegistryError - Simplify NEWS entry
1 parent e6d6cdb commit d3f839d

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

Doc/library/shutil.rst

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,6 @@ Directory and files operations
101101

102102
.. versionadded:: 3.4
103103

104-
.. exception:: ReadError
105-
106-
This exception is raised when an archive cannot be read or is not recognized
107-
as a supported archive format. It is raised by :func:`unpack_archive`.
108-
109-
.. versionadded:: 3.2
110-
111-
.. exception:: RegistryError
112-
113-
This exception is raised when a registry operation with the archiving
114-
and unpacking registries fails, such as registering a duplicate archive
115-
format extension. It is raised by :func:`register_unpack_format`.
116-
117-
.. versionadded:: 3.2
118-
119104

120105
.. function:: copymode(src, dst, *, follow_symlinks=True)
121106

@@ -781,6 +766,13 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
781766
.. versionchanged:: 3.12
782767
Added the *filter* argument.
783768

769+
.. exception:: ReadError
770+
771+
This exception is raised when an archive cannot be read or is not recognized
772+
as a supported archive format. It is raised by :func:`unpack_archive`.
773+
774+
.. versionadded:: 3.2
775+
784776
.. function:: register_unpack_format(name, extensions, function[, extra_args[, description]])
785777

786778
Registers an unpack format. *name* is the name of the format and
@@ -800,6 +792,17 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
800792
*description* can be provided to describe the format, and will be returned
801793
by the :func:`get_unpack_formats` function.
802794

795+
Raises :exc:`RegistryError` if any of the given *extensions* are already
796+
registered for another format.
797+
798+
.. exception:: RegistryError
799+
800+
This exception is raised when a registry operation with the archiving
801+
and unpacking registries fails, such as registering a duplicate archive
802+
format extension. It is raised by :func:`register_unpack_format`.
803+
804+
.. versionadded:: 3.2
805+
803806

804807
.. function:: unregister_unpack_format(name)
805808

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Add :exc:`shutil.ReadError` and :exc:`shutil.RegistryError` to
2-
``shutil.__all__`` and document them.
1+
Publicly expose :exc:`shutil.ReadError` and :exc:`shutil.RegistryError`.

0 commit comments

Comments
 (0)