Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In Python 3.12 tarfile raises DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. #2454

Closed
matthewfeickert opened this issue Mar 13, 2024 · 1 comment · Fixed by #2455
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed / contributions welcome tests pytest

Comments

@matthewfeickert
Copy link
Member

While testing Python 3.12 in CI

pyhf/tests/test_scripts.py

Lines 591 to 604 in adddb07

@pytest.mark.parametrize(
"archive",
[
"https://www.hepdata.net/record/resource/1408476?view=true",
"https://doi.org/10.17182/hepdata.89408.v1/r2",
],
)
def test_patchset_download(
tmp_path, script_runner, requests_mock, tarfile_path, archive
):
requests_mock.get(archive, content=open(tarfile_path, "rb").read())
command = f'pyhf contrib download {archive} {tmp_path.joinpath("likelihoods")}'
ret = script_runner.run(shlex.split(command))
assert ret.success

raised

>       assert ret.success
E       assert False
E        +  where False = <pytest_console_scripts.RunResult object at 0x29fd18b90>.success
...
DeprecationWarning: Python 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.

This should get fixed before Python 3.12 support is added.

@matthewfeickert matthewfeickert added bug Something isn't working help wanted Extra attention is needed / contributions welcome tests pytest labels Mar 13, 2024
@matthewfeickert
Copy link
Member Author

c.f. https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter and PEP 706 – Filter for tarfile.extractall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed / contributions welcome tests pytest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant