Skip to content

Commit 0f2774c

Browse files
committed
MAINT: fixing tarfile deprecation
1 parent c0ebe31 commit 0f2774c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

astroquery/esa/jwst/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
__all__ = ['Jwst', 'JwstClass']
4040

4141

42+
# We do trust the ESA tar files, this is to avoid the new to Python 3.12 deprecation warning
43+
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
44+
if hasattr(tarfile, "fully_trusted_filter"):
45+
tarfile.TarFile.extraction_filter = staticmethod(tarfile.fully_trusted_filter)
46+
47+
4248
class JwstClass(BaseQuery):
4349

4450
"""

astroquery/esa/xmm_newton/core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
__all__ = ['XMMNewton', 'XMMNewtonClass']
3030

3131

32+
# We do trust the ESA tar files, this is to avoid the new to Python 3.12 deprecation warning
33+
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
34+
if hasattr(tarfile, "fully_trusted_filter"):
35+
tarfile.TarFile.extraction_filter = staticmethod(tarfile.fully_trusted_filter)
36+
37+
3238
class XMMNewtonClass(BaseQuery):
3339
data_url = conf.DATA_ACTION
3440
data_aio_url = conf.DATA_ACTION_AIO

0 commit comments

Comments
 (0)