GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-132983: Reduce the size of `_zstdmodule.h` by AA-Turner · Pull Request #133793 · python/cpython

Conversation

@AA-Turner

@AA-Turner AA-Turner commented May 10, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • Issue: Implement PEP 784 - Adding Zstandard to the Python standard library #132983

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
AA-Turner added 8 commits May 10, 2025 01:35
@AA-Turner
Rename inited to initialized, convert to bool
b158d3f
@AA-Turner
Move mt_continue_should_break()
ae9e303
@AA-Turner
Move enum decompress_type
d2e189f
@AA-Turner
Add guard defines
8e5e1ca
@AA-Turner
Use angle-bracket includes
161b826
@AA-Turner
Reduce transitive includes
942be5b
@AA-Turner
Remove Zstd{Compressor,Decompressor,Dict} from _zstdmodule.h
a71aa3c
@AA-Turner
Make _zstdmodule static
9548b6a
@AA-Turner
AA-Turner requested review from emmatyping and picnixz May 10, 2025 00:42
@AA-Turner
AA-Turner requested review from a team and erlend-aasland as code owners May 10, 2025 00:42
@AA-Turner AA-Turner added skip news needs backport to 3.14 bugs and security fixes labels May 10, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label May 10, 2025
@bedevere-app bedevere-app Bot mentioned this pull request May 10, 2025
Implement PEP 784 - Adding Zstandard to the Python standard library #132983
Closed
13 tasks done
@AA-Turner
AA-Turner removed request for a team and erlend-aasland May 10, 2025 00:42
@AA-Turner
regen-all
223216d
emmatyping
emmatyping reviewed May 10, 2025
View reviewed changes
Comment thread Modules/_zstd/_zstdmodule.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

@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

hugovk commented May 10, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

picnixz
picnixz reviewed May 10, 2025
View reviewed changes
Comment thread Modules/_zstd/_zstdmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_zstd/_zstdmodule.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_zstd/_zstdmodule.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_zstd/buffer.h Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_zstd/compressor.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner
Bénédikt's review
bb20445
emmatyping
emmatyping approved these changes May 10, 2025
View reviewed changes
picnixz
picnixz approved these changes May 10, 2025
View reviewed changes

@picnixz picnixz left a comment

Copy link
Copy Markdown
Member

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's fun that the diff for reducing the size is +165/-164.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner and emmatyping reacted with laugh emoji
All reactions
  • 😄 2 reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 10, 2025
@AA-Turner
AA-Turner merged commit 1a548c0 into python:main May 10, 2025
@miss-islington-app

miss-islington-app Bot commented May 10, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 10, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 10, 2025
@AA-Turner @miss-islington
pythongh-132983: Reduce the size of _zstdmodule.h (pythonGH-133793)
f29ced5
(cherry picked from commit 1a548c0)

Co-authored-by: Adam Turner <[email protected]>
@bedevere-app

bedevere-app Bot commented May 10, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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
@miss-islington @AA-Turner
[3.14] gh-132983: Reduce the size of _zstdmodule.h (GH-133793) (#…
f7c441c
…133854)

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

Co-authored-by: Adam Turner <[email protected]>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@AA-Turner @Pranjal095
pythongh-132983: Reduce the size of _zstdmodule.h (python#133793)
4b09e0b
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@AA-Turner @taegyunkim
pythongh-132983: Reduce the size of _zstdmodule.h (python#133793)
527768f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@emmatyping emmatyping emmatyping approved these changes
@picnixz picnixz picnixz approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@AA-Turner @hugovk @emmatyping @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.