`tarfile.open()` does not forward keyword arguments to the underlying `_Stream` object for zstd in stream mode
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
I found the bug when I was browsing the source code, so I just put the source code here:
@classmethod
def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
# irrevalent code...
elif "|" in mode:
# irrevalent code...
compresslevel = kwargs.pop("compresslevel", 6)
preset = kwargs.pop("preset", None)
stream = _Stream(name, filemode, comptype, fileobj, bufsize,
compresslevel, preset)
# irrevalent code...
But the doc says that:
For modes 'w:zst', 'x:zst' and 'w|zst', tarfile.open() accepts the keyword argument level to specify the compression level of the file. The keyword argument options may also be passed, providing advanced Zstandard compression parameters described by CompressionParameter. The keyword argument zstd_dict can be passed to provide a ZstdDict, a Zstandard dictionary used to improve compression of smaller amounts of data.
So there're three keyword arguments: level, options and zstd_dict that need to pass to _Stream constructor, and the constructor needs to change to accept these keyword arguments.
I'll open a PR to fix this soon.
CPython versions tested on:
3.14
Operating systems tested on:
No response
Linked PRs
- gh-139822
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
tarfile.open() と _Stream コンストラクターから始め、zstd を使用するストリームモードに焦点を当ててください。level、options、zstd_dict をどのように渡すべきかを確認し、w|zst に対して対応するドキュメントの動作が機能することを確認してください。リンクされた PR は、この作業がすでに進行中であることを示しています。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100