summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Waldmann <tw@waldmann-edv.de>2023-09-25 15:36:43 +0200
committerThomas Waldmann <tw@waldmann-edv.de>2023-09-25 15:36:43 +0200
commit1a24c2fa433de26a2a5eb3450b9461dfb1a463eb (patch)
treefa6353df0cdf94caed9cb4c9aacace93ef4d81bc /src
parent8f820d1f328bc496836bf2b7e64732e7ff4cf6e9 (diff)
avoid tarfile deprecation warning for py312
Diffstat (limited to 'src')
-rw-r--r--src/borg/archiver.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/borg/archiver.py b/src/borg/archiver.py
index abf4fbb30..e3c48ab68 100644
--- a/src/borg/archiver.py
+++ b/src/borg/archiver.py
@@ -101,6 +101,12 @@ STATS_HEADER = " Original size Compressed size Ded
PURE_PYTHON_MSGPACK_WARNING = "Using a pure-python msgpack! This will result in lower performance."
+# 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 argument(args, str_or_bool):
"""If bool is passed, return it. If str is passed, retrieve named attribute from args."""
if isinstance(str_or_bool, str):