Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-132983: Split_zstd_set_c_parameters#133921

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AA-Turner merged 17 commits intopython:mainfromAA-Turner:zstd-set-params
May 28, 2025

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedMay 12, 2025
edited by bedevere-appbot
Loading

The current_zstd_set_c_parameters shares little between the two possible (int or dict) paths. By splitting the function, we can now use thePy_ssize_t AC converter.

One slight change worth noting is that the constructor won't raise an error whenlevel is$-2^{63}$ but will just silently use the default. cc@erlend-aasland if there's a better method/sentinel we can use in the clinic to detect if the value has been set or not.

>>> _zstd.ZstdCompressor(level=-(1<<63)+1)Traceback (most recent call last):  File "<python-input-17>", line 1, in <module>    _zstd.ZstdCompressor(level=-(1<<63)+1)    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ValueError: compression level -9223372036854775807 not in valid range -131072 <= level <= 22.>>> _zstd.ZstdCompressor(level=-(1<<63))<compression.zstd.ZstdCompressor object at 0x7f61875b2210>

I also think it might be worth considering removing the level XOR options check, as we could adopt the rule that a compression level set in an options dict overrides thelevel parameter. I can see reasonable arguments to keep the status quo, however, so I've not done this yet.

A

cc@Rogdham

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commentedMay 12, 2025
edited
Loading

if there's a better method/sentinel we can use in the clinic to detect if the value has been set or not

No, there is not. You cannot distinguish the passed value from the default value. It is better to not using Argument Clinic for conversion of this parameter.

BTW,Py_ssize_t is the same asint on 32-bit platforms, so there is no good reason to use it here.

@emmatyping

This comment was marked as resolved.

@serhiy-storchaka

This comment was marked as resolved.

@emmatyping

This comment was marked as outdated.

@emmatyping

This comment was marked as outdated.

@bedevere-app
Copy link

When you're done making the requested changes, leave the comment:I have made the requested changes; please review again.

Copy link
Member

@emmatypingemmatyping left a comment

Choose a reason for hiding this comment

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

A few suggestions for wording of error messages, but I think otherwise this looks great. Thank you for refactoring this!

Copy link
Member

@emmatypingemmatyping left a comment

Choose a reason for hiding this comment

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

Thanks, this is a great refactor!

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

I am not sure about term "illegal", this is a question to native speakers, but the rest LGTM. Thank you.

AA-Turnerand others added3 commitsMay 28, 2025 14:12
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@emmatyping
Copy link
Member

I am not sure about term "illegal"

It's not wrong, but perhaps invalid is better?

@AA-TurnerAA-Turner merged commit11f7a93 intopython:mainMay 28, 2025
38 checks passed
@miss-islington-app
Copy link

Thanks@AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 28, 2025
(cherry picked from commit11f7a93)Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app
Copy link

GH-134838 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 28, 2025
AA-Turner added a commit that referenced this pull requestMay 28, 2025
gh-132983: Split ``_zstd_set_c_parameters`` (GH-133921)(cherry picked from commit11f7a93)Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

@emmatypingemmatypingemmatyping approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@AA-Turner@serhiy-storchaka@emmatyping

[8]ページ先頭

©2009-2025 Movatter.jp