Skip to content

gh-160781: Fix StringIO.truncate() rejecting sizes above 2**31 - 1 on Windows - #160784

Merged
StanFromIreland merged 3 commits into
python:mainfrom
cmaloney:bio_stringio
Oct 29, 2026
Merged

StanFromIreland merged 3 commits into
python:mainfrom
cmaloney:bio_stringio

Conversation

@cmaloney

@cmaloney cmaloney commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

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.

…- 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 <[email protected]>
@StanFromIreland StanFromIreland changed the title gh-160781: Fix StringIO.truncate() rejecting sizes above 2**31 - 1 on Windows gh-160781: Fix StringIO.truncate() rejecting sizes above 2**31 - 1 on Windows Oct 29, 2026
@StanFromIreland
StanFromIreland merged commit 0bfee22 into python:main Oct 29, 2026
106 of 108 checks passed
@miss-islington-app

Copy link
Copy Markdown

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

@miss-islington-app

Copy link
Copy Markdown

Sorry, @cmaloney and @StanFromIreland, I could not cleanly backport this to 3.15 due to a conflict.

Please backport manually with cherry_picker, see the devguide for more information.

cherry_picker 0bfee223909adc113ece862cb8d7d807c35e201c 3.15

@StanFromIreland

Copy link
Copy Markdown
Member

Merged, thanks. Can you please open the backport? TiA!

@cmaloney
cmaloney deleted the bio_stringio branch October 29, 2026 16:59
@cmaloney

Copy link
Copy Markdown
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 <[email protected]>
@bedevere-app

bedevere-app Bot commented Oct 29, 2026

Copy link
Copy Markdown

GH-160918 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 29, 2026
@cmaloney

Copy link
Copy Markdown
Contributor Author

No backport to 3.14 needed / this was added in 3.15

StanFromIreland pushed a commit that referenced this pull request Oct 29, 2026
…*31 - 1` on Windows (GH-160784) (#160918)

(cherry picked from commit 0bfee22)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants