Skip to content

gh-146578: _zstd: Fix printf format for pledged size errors#146576

Merged
emmatyping merged 1 commit intopython:mainfrom
cuiweixie:fix-zstd-printf-ull
Apr 21, 2026
Merged

gh-146578: _zstd: Fix printf format for pledged size errors#146576
emmatyping merged 1 commit intopython:mainfrom
cuiweixie:fix-zstd-printf-ull

Conversation

@cuiweixie
Copy link
Copy Markdown
Contributor

@cuiweixie cuiweixie commented Mar 28, 2026

Summary

Replace invalid %ull with %llu in zstd_contentsize_converter ValueError
format strings. The correct specifier for unsigned long long is %llu.

Test plan

  • Build with _zstd; change affects error-message formatting only.

Use %llu instead of %ull for unsigned long long in
zstd_contentsize_converter ValueError messages.
@cuiweixie cuiweixie changed the title _zstd: Fix printf format for pledged size errors gh-146578: _zstd: Fix printf format for pledged size errors Mar 28, 2026
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Good catch! Could you please add tests?

Most likely there are already tests for passing out of range size argument, but they do not test the error message or the test is too lenient. You can change ValueError to something other, like SystemError, run the test and look what fails.

@sunmy2019
Copy link
Copy Markdown
Member

Inspired by this, I wrote a plugin to capture similar issues. Are you guys interested? I can open a new issue.

@emmatyping
Copy link
Copy Markdown
Member

Inspired by this, I wrote a plugin to capture similar issues. Are you guys interested? I can open a new issue.

I would say if you find issues similar to this one those are likely bugs so you should open a new issue. Good idea to do this analysis!

@picnixz
Copy link
Copy Markdown
Member

picnixz commented Mar 29, 2026

If you do find similar issues, just open a single issue. You can open multiple PRs for that same issue though.

@serhiy-storchaka
Copy link
Copy Markdown
Member

If you found other similar bugs, they should be fixed. I doubt similar bugs will occur on regular basis.

@sunmy2019
Copy link
Copy Markdown
Member

The diff is too big so I created a draft PR to display the diff.

issue #146615 pr #146616

@emmatyping emmatyping merged commit 09233bd into python:main Apr 21, 2026
63 checks passed
@miss-islington-app
Copy link
Copy Markdown

Thanks @cuiweixie for the PR, and @emmatyping for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented Apr 21, 2026

GH-148855 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 Apr 21, 2026
emmatyping pushed a commit that referenced this pull request Apr 21, 2026
…H-146576) (#148855)

gh-146578: _zstd: Fix printf format for pledged size errors (GH-146576)

Use %llu instead of %ull for unsigned long long in zstd_contentsize_converter ValueError messages.
(cherry picked from commit 09233bd)

Co-authored-by: cui <cuiweixie@gmail.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.

5 participants