Skip to content

Commit

Permalink
avoid tarfile deprecation warning for py312
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWaldmann committed Jul 10, 2023
1 parent b86168e commit 1fff2af
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/borg/archiver/tar_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@

logger = create_logger(__name__)

# Python 3.12+ gives a deprecation warning if TarFile.extraction_filter is None, which disturbs our unit tests.
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
if hasattr(tarfile, "fully_trusted_filter"):
tarfile.TarFile.extraction_filter = tarfile.fully_trusted_filter # type: ignore


def get_tar_filter(fname, decompress):
# Note that filter is None if fname is '-'.
Expand Down

0 comments on commit 1fff2af

Please sign in to comment.