Skip to content

gh-132983: Reduce the size of _zstdmodule.h #133793

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

Merged
merged 10 commits into from
May 10, 2025
Merged

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented May 10, 2025

We should try and reduce the content in the header file, as it is exposed to anything that includes it.

  • mt_continue_should_break() moves into compressor.c
  • The decompress_type enum moves into decompressor.c
  • Replace #pragma once (not used for any other modules or non-vendored code) with guard defines
  • Use angle-bracket includes for z{std,dict}.h
  • Add a zstddict.h header file to contain the definition of the ZstdDict struct
  • Move the ZstdCompressor struct to compressor.c (likewise for decompressor)
  • Make PyModuleDef _zstdmodule static

A

@hugovk hugovk changed the title GH-132983: Reduce the size of _zstdmodule.h gh-132983: Reduce the size of _zstdmodule.h May 10, 2025
@hugovk
Copy link
Member

hugovk commented May 10, 2025

Nit note about PR titles, the convention is lowercase gh-NNN for issues, and uppercase GH-NNN for PRs:

please make sure to reference the issue number using gh-NNNNN: prefix in the pull request title

https://devguide.python.org/getting-started/pull-request-lifecycle/#submitting

[3.9] gh-12345: Fix the Spam Module (GH-NNNN)

Here gh-12345 is the GitHub issue number, and GH-NNNN is the number of the original pull request.

https://devguide.python.org/core-developers/committing/#backporting-changes-to-an-older-version

Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

It's fun that the diff for reducing the size is +165/-164.

@AA-Turner AA-Turner merged commit 1a548c0 into python:main May 10, 2025
42 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 request May 10, 2025
(cherry picked from commit 1a548c0)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented May 10, 2025

GH-133854 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label May 10, 2025
@AA-Turner AA-Turner deleted the zstd-headers branch May 10, 2025 21:48
AA-Turner added a commit that referenced this pull request May 10, 2025
…133854)

gh-132983: Reduce the size of ``_zstdmodule.h`` (GH-133793)
(cherry picked from commit 1a548c0)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants