diff options
author | Thomas Waldmann <tw@waldmann-edv.de> | 2023-07-10 17:06:24 +0200 |
---|---|---|
committer | Thomas Waldmann <tw@waldmann-edv.de> | 2023-09-14 03:04:36 +0200 |
commit | 1ed7f29572e92e1903a7eddc242ccf8bd93c7474 (patch) | |
tree | ef2922dd3b1248dcabd861b3bd6bc4a64a914277 /src | |
parent | c4327c28194af3c3e9ada9ecdfed6bf4ef5cefd3 (diff) |
avoid tarfile deprecation warning for py312
Diffstat (limited to 'src')
-rw-r--r-- | src/borg/archiver/tar_cmds.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/borg/archiver/tar_cmds.py b/src/borg/archiver/tar_cmds.py index 30f4a6d68..b18cb24d0 100644 --- a/src/borg/archiver/tar_cmds.py +++ b/src/borg/archiver/tar_cmds.py @@ -29,6 +29,11 @@ from ..logger import create_logger 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 '-'. |