Skip to content

_zstd: Fix printf format for pledged size errors #146578

Description

@cuiweixie

Problem

In zstd_contentsize_converter (Modules/_zstd/compressor.c), ValueError messages use the format specifier %ull when printing ZSTD_CONTENTSIZE_ERROR. The correct C99 format for unsigned long long is %llu; %ull is invalid.

Proposed fix

Replace %ull with %llu in both error paths.

Linked PRs

Activity

  1. cuiweixie commented on Mar 28, 2026

    @cuiweixie
    ContributorAuthor
  2. added
    type-bugAn unexpected behavior, bug, or error
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Mar 28, 2026
  3. brianschubert commented on Mar 28, 2026

    @brianschubert
    Contributor

    I can confirm that the exception message is currently formatted incorrectly (note the trailing ll):

    >>> compression.zstd.ZstdCompressor().set_pledged_input_size(2**64)
    Traceback (most recent call last):
      File "<python-input-1>", line 1, in <module>
        compression.zstd.ZstdCompressor().set_pledged_input_size(2**64)
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
    ValueError: size argument should be a positive int less than 4294967294ll
  4. added 2 commits that reference this issue on Apr 21, 2026
  5. added a commit that references this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixes3.15bugs and security fixesextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions