gh-74696: Do not change the current working directory in shutil.make_archive() if possible (GH-93160)

It is no longer changed when create a zip or tar archive.

It is still changed for custom archivers registered with shutil.register_archive_format()
if root_dir is not None.

Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Serhiy Storchaka 2022-06-22 11:47:25 +03:00 committed by GitHub
parent f805d37641
commit fda4b2f063
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 106 additions and 52 deletions

View file

@ -574,12 +574,18 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
.. note::
This function is not thread-safe.
This function is not thread-safe when custom archivers registered
with :func:`register_archive_format` are used. In this case it
temporarily changes the current working directory of the process
to perform archiving.
.. versionchanged:: 3.8
The modern pax (POSIX.1-2001) format is now used instead of
the legacy GNU format for archives created with ``format="tar"``.
.. versionchanged:: 3.10.6
This function is now made thread-safe during creation of standard
``.zip`` and tar archives.
.. function:: get_archive_formats()