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-91349: Replace zlib with zlib-ng in Windows build by zooba · Pull Request #131438 · python/cpython

gh-91349: Replace zlib with zlib-ng in Windows build #131438

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.

Sign up for GitHub

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
zooba merged 10 commits into python:main from zooba:gh-91349
Mar 19, 2025

Uh oh!

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

Merged

gh-91349: Replace zlib with zlib-ng in Windows build #131438

Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit Hold shift + click to select a range
de56164
gh-91349: Replace zlib with zlib-ng in Windows build
zooba Mar 19, 2025
1347c50
Updated readme.txt
zooba Mar 19, 2025
7fd8f26
Fix includes for PGO build
zooba Mar 19, 2025
f919749
Use correct include dirs
zooba Mar 19, 2025
fb6500d
Add NEWS
zooba Mar 19, 2025
89d44a1
Fix debug reference and some warnings
zooba Mar 19, 2025
08eecb1
Exclude Intel optimizations better on ARM64
zooba Mar 19, 2025
548daa7
Update docs and whatsnew
zooba Mar 19, 2025
f108044
Remove unresolved reference from docs
zooba Mar 19, 2025
085fa10
Include ZLIBNG_VERSION in pythoninfo
zooba Mar 19, 2025
File filter
Filter by extension


Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

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

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

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

Diff view
Diff view

There are no files selected for viewing

12 changes: 12 additions & 0 deletions 12 Doc/library/zlib.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,18 @@ the following constants:
.. versionadded:: 3.3


.. data:: ZLIBNG_VERSION

The version string of the zlib-ng library that was used for building the
module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and
:data:`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API
provided by zlib-ng.

If zlib-ng was not used to build the module, this constant will be absent.

.. versionadded:: 3.14


.. seealso::

Module :mod:`gzip`
Expand Down
13 changes: 13 additions & 0 deletions 13 Doc/whatsnew/3.14.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,7 @@ zipinfo
to produce reproducible output.
(Contributed by Jiahao Li in :gh:`91279`.)


.. Add improved modules above alphabetically, not here at the end.

Optimizations
Expand Down Expand Up @@ -1078,6 +1079,18 @@ uuid
(Contributed by Bénédikt Tran in :gh:`128150`.)


zlib
----

* On Windows, ``zlib-ng`` is now used as the implementation of the
:mod:`zlib` module. This should produce compatible and comparable
results with better performance, though it is worth noting that
:const:`~zlib.Z_BEST_SPEED` (1) may result in significantly less
compression than the previous implementation (while also significantly
reducing the time taken to compress).
(Contributed by Steve Dower in :gh:`91349`.)


Deprecated
==========

Expand Down
2 changes: 2 additions & 0 deletions 2 Misc/NEWS.d/next/Windows/2025-03-19-01-11-56.gh-issue-91349.pmtp-J.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Replaces our copy of ``zlib`` with ``zlib-ng``, for performance improvements
in :mod:`zlib`.
12 changes: 6 additions & 6 deletions 12 Misc/externals.spdx.json
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,25 @@
"versionInfo": "5.2.5"
},
{
"SPDXID": "SPDXRef-PACKAGE-zlib",
"SPDXID": "SPDXRef-PACKAGE-zlib-ng",
"checksums": [
{
"algorithm": "SHA256",
"checksumValue": "e3f3fb32564952006eb18b091ca8464740e5eca29d328cfb0b2da22768e0b638"
"checksumValue": "00bbd88709bc416cb96160ab61d3e1c8f76e106799af7328d0fe434dc7dd5004"
}
],
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-1.3.1.tar.gz",
"downloadLocation": "https://github.com/python/cpython-source-deps/archive/refs/tags/zlib-ng-2.2.4.tar.gz",
"externalRefs": [
{
"referenceCategory": "SECURITY",
"referenceLocator": "cpe:2.3:a:zlib:zlib:1.3.1:*:*:*:*:*:*:*",
"referenceLocator": "cpe:2.3:a:zlib-ng:zlib-ng:2.2.4:*:*:*:*:*:*:*",
Comment thread

@zooba zooba Mar 19, 2025

Copy link
Copy Markdown
Member Author

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.

I'll admit I just guessed this, in order to unblock my testing (couldn't build at all with an invalid SBOM). If it's not right, let me know

Sorry, something went wrong.

Uh oh!

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

All reactions

@sethmlarson sethmlarson Mar 19, 2025

Copy link
Copy Markdown
Contributor

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.

This is likely the CPE that would get used, although we can't be for certain until a CVE exists with it... the only one I could find with some searching is cpe:...:zlib-ng:minizip-ng which is for a different component but at least the organization is a match.

Sorry, something went wrong.

Uh oh!

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

zooba and gpshead reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
"referenceType": "cpe23Type"
}
],
"licenseConcluded": "NOASSERTION",
"name": "zlib",
"name": "zlib-ng",
"primaryPackagePurpose": "SOURCE",
"versionInfo": "1.3.1"
"versionInfo": "2.2.4"
}
],
"spdxVersion": "SPDX-2.3"
Expand Down
6 changes: 6 additions & 0 deletions 6 Modules/zlibmodule.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,12 @@ zlib_exec(PyObject *mod)
PyUnicode_FromString(zlibVersion())) < 0) {
return -1;
}
#ifdef ZLIBNG_VERSION
if (PyModule_Add(mod, "ZLIBNG_VERSION",
Comment thread

@zooba zooba Mar 19, 2025

Copy link
Copy Markdown
Member Author

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.

Figured we'd want some way to detect this other than looking at the text in ZLIB_VERSION

Sorry, something went wrong.

Uh oh!

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

All reactions

@gpshead gpshead Mar 19, 2025

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.

makes sense. annoying to have optional attributes that one would use hasattr or getattr on instead of blindly accessing, but realistically nobody should care as this is more internal informational so this is fine.

Sorry, something went wrong.

Uh oh!

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

All reactions

@zooba zooba Mar 19, 2025

Copy link
Copy Markdown
Member Author

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.

Yeah, the main place it'll be used is in pythoninfo, which already handles absent attributes.

We have more offensive optional attributes in our extension modules 😆

Sorry, something went wrong.

Uh oh!

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

All reactions
PyUnicode_FromString(ZLIBNG_VERSION)) < 0) {
return -1;
}
#endif
if (PyModule_AddStringConstant(mod, "__version__", "1.0") < 0) {
return -1;
}
Expand Down
Loading
Oops, something went wrong.

Uh oh!

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

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 01402520 — 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.