Skip to content

Commit

Permalink
Catch tar deprecation warning in extract_archive()
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Nov 27, 2024
1 parent 92e64c6 commit ee1947d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion audeer/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tarfile
import typing
import urllib.request
import warnings
import zipfile

from audeer.core.path import path as safe_path
Expand Down Expand Up @@ -369,7 +370,12 @@ def extract_archive(
desc=desc,
disable=disable,
):
tf.extract(member, destination, numeric_owner=True)
# In Python 3.12 the `filter` argument was introduced.
# In a later version we should use `filter="tar"`,
# until then we catch the deprecation warning
with warnings.catch_warnings():
warnings.simplefilter("ignore")
tf.extract(member, destination, numeric_owner=True)
files = [m.name for m in members]
else:
raise RuntimeError(
Expand Down

0 comments on commit ee1947d

Please sign in to comment.