-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-132983: Simplify _zstd_exec()
#133775
Conversation
There was a problem hiding this 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 for lzma.LZMACompressor so it would be better to do the same for the Zstd* types)
There was a problem hiding this 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.
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add Py_TPFLAGS_IMMUTABLETYPE in this PR or in another.
|
Thanks @AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
(cherry picked from commit bbe9c31) Co-authored-by: Adam Turner <[email protected]>
|
GH-133786 is a backport of this pull request to the 3.14 branch. |
gh-132983: Simplify ``_zstd_exec()`` (GH-133775) (cherry picked from commit bbe9c31) Co-authored-by: Adam Turner <[email protected]>
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.add_type_to_module()function with anADD_TYPEmacro, usingPyModule_AddTypeinstead ofPyModule_AddObjectRef._zstdmodule.