Skip to content

Conversation

@beavailable
Copy link
Contributor

@beavailable beavailable commented Oct 9, 2025

@beavailable beavailable changed the title gh-139821: Correctly forward keyword arguments gh-139821: Make tarfile.open correctly forward keyword arguments for zstd in stream mode. Oct 9, 2025
Lib/tarfile.py Outdated
Comment on lines 340 to 341
def __init__(self, name, mode, comptype, fileobj, bufsize,
compresslevel, preset):
compresslevel, preset, level, options, zstd_dict):
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be cleaner at this point to take **kwargs in _Stream and pop items per-(de)compressor. Having stream take every possible argument doesn't seem like a great idea for readability purposes since many of the arguments will be unused. I believe because this was up in the air and also how to treat compressLevel vs level, we intentionally didn't include this in 3.14 before the beta cutoff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. Thanks for the explanation.
I'll rewrite it.

Copy link
Member

Choose a reason for hiding this comment

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

The new revision looks a lot better, thank you! I would also suggest using .get so that if the keywords are not passed then we don't get key errors and instead use fallbacks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

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.

2 participants