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

zoneinfo.rebuild: Extract using tarfile data filter (PEP 706) if available #1295

Closed
wants to merge 2 commits into from

Conversation

encukou
Copy link

@encukou encukou commented Jun 27, 2023

Summary of changes

In new versions of Python, tarfile allows filters (PEP-706), a mechanism to limit allowed features when extracting tarballs. The data filter, suggested here, is intended for pure data files. A cross-platform tarball like a tzdata release definitely should not need more. Details on what it does are here.

This uses the mechanism if it's available.

The incantation, a bit convoluted in order to be backwards-compatible, is taken from the docs.

Pull Request Checklist

  • Changes have tests

    The can be reproduced using python3.12 -Werror updatezinfo.py, which fails with a DeprecationWarning error.
    The code is called in the release process/test setup, rather than tests themselves. Also, 3.12 is not in the CI matrix yet.
    If you think manual testing isn't enough, I'd appreciate pointers on how to test this.

  • Authors have been added to AUTHORS.md

    I'm fine without that, if it's OK with you.

  • News fragment added in changelog.d. See CONTRIBUTING.md for details

@pganssle
Copy link
Member

Thanks for doing this Petr, but the main thing blocking new releases of dateutil right now is basically ripping zoneinfo and this whole tarball mechanism out of the library entirely, so any improvements wouldn't end up making it into a new release anyway. Interesting to hear about this new feature, though!

@pganssle pganssle closed this Jun 27, 2023
@encukou
Copy link
Author

encukou commented Jun 27, 2023

Ah, great! No code is best code :)
Sorry for the noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants