Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-134209: use heap-allocated memory in_curses.window.{instr,getstr}#134283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 34 commits intopython:mainfromzydtiger:fix-issue-134209
May 20, 2025

Conversation

zydtiger
Copy link
Contributor

@zydtigerzydtiger commentedMay 19, 2025
edited by github-actionsbot
Loading

Allocated curses buffer on heap and modified documentation to show this change.


📚 Documentation preview 📚:https://cpython-previews--134283.org.readthedocs.build/

@python-cla-bot
Copy link

python-cla-botbot commentedMay 19, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@gpsheadgpshead self-assigned thisMay 19, 2025
@picnixzpicnixz changed the titlegh-134209: Allocating curses buffer on heapgh-134209: use heap-allocated memory in_curses.window.{instr,getstr}May 20, 2025
@picnixz
Copy link
Member

Ha. As I feared:

Traceback (most recent call last):  File "/Users/runner/work/cpython/cpython/Lib/test/test_curses.py", line 379, in test_getstr    self.assertEqual(win.getstr(3, 1, 2), b'Lo')    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: b'' != b'Lo'

I suspect that the value being returned is not reliable for some reason. Unfortunately, we'll need to usestrlen I think. That's one thing I hate with libcurses, namely most of the return values semantics are implementation-defined -_-

zydtigerand others added6 commitsMay 20, 2025 10:40
add version changed messageCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
add version changed messageCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…nhTcF.rstCo-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

By the way, no need to hit the "update branch" button if the CI is green. Usually it's only to pull newest (infra-related) changes and/or patches for tests that were already failing.

zydtiger reacted with thumbs up emoji

Copy link
Member

@picnixzpicnixz left a comment
edited
Loading

Choose a reason for hiding this comment

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

Final nitpick. Since I'll be re-changing the logic a bit in#134325, I think this one is good. After the commit, I'll run the build bots.

@picnixzpicnixz added 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section labelsMay 20, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@picnixz for commit6510d09 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134283%2Fmerge

If you want to schedule another build, you need to add the🔨 test-with-buildbots label again.

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@picnixz for commit6510d09 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134283%2Fmerge

If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed 🔨 test-with-refleak-buildbotsTest PR w/ refleak buildbots; report in status section 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelsMay 20, 2025
@picnixz
Copy link
Member

picnixz commentedMay 20, 2025
edited
Loading

Now, do NOT commit anything until all build bots are done (so don't hit "update branch") otherwise the report will be lost on GH.

Thanks for your first contribution!

zydtiger reacted with thumbs up emoji

@zydtiger
Copy link
ContributorAuthor

Thank you so much to guide me through the process! Glad that I'm able to contribute.

picnixz reacted with heart emoji

@gpsheadgpsheadenabled auto-merge (squash)May 20, 2025 20:14
@gpsheadgpshead added the needs backport to 3.14bugs and security fixes labelMay 20, 2025
@gpsheadgpshead merged commitaadda87 intopython:mainMay 20, 2025
41 checks passed
@miss-islington-app
Copy link

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

zydtiger reacted with hooray emoji

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 20, 2025
…getstr}` (pythonGH-134283)* made curses buffer heap allocated instead of stack* change docs to explicitly mention the max buffer size* changing GetStr() function to behave similarly too* Update Doc/library/curses.rst* Update instr with proper return error handling* Update Modules/_cursesmodule.c* change to strlen and better memory safety* change from const int to Py_ssize_t* add mem allocation guard* update versionchanged to mention it was an increase.* explicitly use versionchanged 3.14 as that is its own branch now.TESTED: `python -m test -u curses test_curses`---------(cherry picked from commitaadda87)Co-authored-by: tigerding <43339228+zydtiger@users.noreply.github.com>Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@bedevere-app
Copy link

GH-134391 is a backport of this pull request to the3.14 branch.

zydtiger reacted with hooray emoji

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 20, 2025
gpshead added a commit that referenced this pull requestMay 20, 2025
…,getstr}` (GH-134283) (#134391)gh-134209: use heap-allocated memory in `_curses.window.{instr,getstr}` (GH-134283)* made curses buffer heap allocated instead of stack* change docs to explicitly mention the max buffer size* changing GetStr() function to behave similarly too* Update Doc/library/curses.rst* Update instr with proper return error handling* Update Modules/_cursesmodule.c* change to strlen and better memory safety* change from const int to Py_ssize_t* add mem allocation guard* update versionchanged to mention it was an increase.* explicitly use versionchanged 3.14 as that is its own branch now.TESTED: `python -m test -u curses test_curses`---------(cherry picked from commitaadda87)Co-authored-by: tigerding <43339228+zydtiger@users.noreply.github.com>Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>Co-authored-by: Gregory P. Smith <greg@krypto.org>Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

Oh so you treated it as a bug fix for 3.14/3.15 only? I'm ok although I would have considered this a feature but since it's scope is really small, it's fine IMO.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gpsheadgpsheadgpshead approved these changes

@picnixzpicnixzpicnixz approved these changes

Assignees

@gpsheadgpshead

Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@zydtiger@picnixz@bedevere-bot@gpshead

[8]ページ先頭

©2009-2025 Movatter.jp