Repository navigation
gh-160781: Fix StringIO.truncate() rejecting sizes above 2**31 - 1 on Windows - #160784
Merged
Merged
Conversation
…- 1 on Windows StringIO.truncate() converted its argument with PyLong_AsLong(), which rejects sizes above 2**31 - 1 on Windows where C long is 32-bit. Use PyNumber_AsSsize_t() like the Py_ssize_t Argument Clinic converter it used before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StanFromIreland
approved these changes
Oct 29, 2026
StringIO.truncate() rejecting sizes above 2**31 - 1 on Windows
|
Thanks @cmaloney for the PR, and @StanFromIreland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
Sorry, @cmaloney and @StanFromIreland, I could not cleanly backport this to Please backport manually with cherry_picker, see the devguide for more information. |
Member
|
Merged, thanks. Can you please open the backport? TiA! |
Contributor
Author
|
Yep, will work on backports today |
cmaloney
added a commit
to cmaloney/cpython
that referenced
this pull request
Oct 29, 2026
…ve `2**31 - 1` on Windows (pythonGH-160784) (cherry picked from commit 0bfee22) Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
|
GH-160918 is a backport of this pull request to the 3.15 branch. |
Contributor
Author
|
No backport to 3.14 needed / this was added in 3.15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
StringIO.truncate() converted its argument with PyLong_AsLong(), which rejects sizes above 2**31 - 1 on Windows where C long is 32-bit. Use PyNumber_AsSsize_t() like the Py_ssize_t Argument Clinic converter it used before.