Skip to content

Conversation

@Rogdham
Copy link
Contributor

@Rogdham Rogdham commented Dec 7, 2025

Adding tuple[ZstdDict, int] to the possible values of the zstd_dict parameter.

Per the documentation:

When passing a ZstdDict to a function, the as_digested_dict and as_undigested_dict attributes can control how the dictionary is loaded by passing them as the zstd_dict argument, for example, compress(data, zstd_dict=zd.as_digested_dict).

…and both as_digested_dict and as_undigested_dict attributes of ZstdDict give a tuple[ZstdDict, int].

@github-actions
Copy link
Contributor

github-actions bot commented Dec 7, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Rogdham Rogdham marked this pull request as ready for review December 7, 2025 13:12
@Rogdham
Copy link
Contributor Author

Rogdham commented Dec 7, 2025

I noticed that the CPython documentation mentions for all these parameters that they must be a ZstdDict instance or None. But latter the part about Zstandard dictionaries says that we actually can pass zd.as_digested_dict or zd.as_undigested_dict.

I guess this is on purpose, to make the documentation easier to read.

@emmatyping 👋

@emmatyping
Copy link
Member

I guess this is on purpose, to make the documentation easier to read.

Yep! I think it would be harder to understand the high level APIs if we mentioned the (Un)digested dictionaries but if you have wording you think will work I'd be happy to review it!

@srittau srittau merged commit 3e74d5c into python:main Dec 8, 2025
63 checks passed
@Rogdham
Copy link
Contributor Author

Rogdham commented Dec 8, 2025

Thank you for the reviews & merge! 🤗

@Rogdham Rogdham deleted the zstd_dict_tuple branch December 8, 2025 16:26
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.

3 participants