Skip to content

Support linking against zlib-rs and libbzip2-rs #139314

@emmatyping

Description

@emmatyping

Feature or enhancement

The Trifecta Tech Foundation has sponsored work on Rust re-implementations of zlib and libbzip2.

These implementations are as fast or faster than their C counterparts (including zlib-chromium and zlib-ng). zlib-rs has seen adoption in Firefox, cargo, and many other major tools, including uv. These implementations are also "drop-in" replacements - they just require slight adjustment to linker arguments.

I think adding support for linking against zlib-rs and libbzip2-rs should be easy to do and maintain, and enable safer builds of CPython.

Eventually (not proposing this yet!), perhaps we could use zlib-rs for Windows builds to provide greater memory safety.

Related issue discussing supporting zlib-ng (mostly Unix build support is left): #91349

I have a draft PR with an implementation below:

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildextension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions