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: Simplify_zstd_exec()#133775

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 6 commits intopython:mainfromAA-Turner:zstd-exec
May 9, 2025
Merged

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedMay 9, 2025
edited
Loading

cc@Rogdham (can't request review).

Follows on from#133670. Again best reviewed commit-by-commit. We remove around 100 lines of C code overall.

The last commit (6a3a135 (#133775)) only serves to merge two functions and contains no behaviour change, but does increase the diff size.

  • Rename type specs to add underscores after 'zstd'
  • Replace theadd_type_to_module() function with anADD_TYPE macro, usingPyModule_AddType instead ofPyModule_AddObjectRef.
  • Remove the unused 'empty_readonly_memoryview', 'str_flush', 'str_read', 'str_readinto', and 'str_write' module state members
  • Set the CONTINUE/FLUSH_* constants in Python rather than C. To achieve this, export the three ZSTD_EndDirective enum members from the_zstd module.

Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

Overall, I think it's a nice improvement but usually, C classes are read-only (e.g.,_sha2.SHA2Type does not allow setting class variables afterwards; the same holds forlzma.LZMACompressor so it would be better to do the same for the Zstd* types)

serhiy-storchaka reacted with thumbs up emoji
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.

It would be better to make classes implemented in C immutable.

AA-Turner and emmatyping reacted with thumbs up emoji
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! These are great refactors.

Copy link
Member

@picnixzpicnixz left a comment

Choose a reason for hiding this comment

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

You can addPy_TPFLAGS_IMMUTABLETYPE in this PR or in another.

@AA-TurnerAA-Turner merged commitbbe9c31 intopython:mainMay 9, 2025
42 checks passed
@AA-TurnerAA-Turner deleted the zstd-exec branchMay 9, 2025 19:15
@AA-TurnerAA-Turner added the needs backport to 3.14bugs and security fixes labelMay 9, 2025
@miss-islington-app
Copy link

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

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

GH-133786 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 9, 2025
AA-Turner added a commit that referenced this pull requestMay 9, 2025
gh-132983: Simplify ``_zstd_exec()`` (GH-133775)(cherry picked from commitbbe9c31)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 left review comments

@emmatypingemmatypingemmatyping approved these changes

@picnixzpicnixzpicnixz approved these changes

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

Successfully merging this pull request may close these issues.

4 participants
@AA-Turner@serhiy-storchaka@emmatyping@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp