1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-03-10 06:03:38 +00:00

avoid tarfile deprecation warning for py312

This commit is contained in:
Thomas Waldmann 2023-09-25 15:36:43 +02:00
parent 8f820d1f32
commit 1a24c2fa43
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -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." 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): def argument(args, str_or_bool):
"""If bool is passed, return it. If str is passed, retrieve named attribute from args.""" """If bool is passed, return it. If str is passed, retrieve named attribute from args."""
if isinstance(str_or_bool, str): if isinstance(str_or_bool, str):