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

gh-75955: tarfile: Allow configuring the record size #129260

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

emontnemery
Copy link
Contributor

@emontnemery emontnemery commented Jan 24, 2025

Allow configuring the record size of a tarfile from the default of 20, as requested in #75955, by adding a new optional parameter blocking_factor to tarfile.TarFile. This matches the --blocking-factor parameter supported by GNU tar.

The blocking_factor is only used to influence the padding when writing to an archive, just as the previously hard coded blocking factor of 20.


📚 Documentation preview 📚: https://cpython-previews--129260.org.readthedocs.build/

def __init__(self, name=None, mode="r", fileobj=None, format=None,
tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
errors="surrogateescape", pax_headers=None, debug=None,
errorlevel=None, copybufsize=None, stream=False):
errorlevel=None, copybufsize=None, stream=False,
blocking_factor=None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of None, should the blocking_factor default to 20, or a constant BLOCKING_FACTOR?

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

Successfully merging this pull request may close these issues.

1 participant