1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-31 20:26:40 +00:00

avoid tarfile deprecation warning for py312

This commit is contained in:
Thomas Waldmann 2023-07-10 17:06:24 +02:00
parent c4327c2819
commit 1ed7f29572
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -29,6 +29,11 @@
logger = create_logger(__name__)
# Python 3.12+ gives a deprecation warning if TarFile.extraction_filter is None.
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
if hasattr(tarfile, "fully_trusted_filter"):
tarfile.TarFile.extraction_filter = staticmethod(tarfile.fully_trusted_filter) # type: ignore
def get_tar_filter(fname, decompress):
# Note that filter is None if fname is '-'.