-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
_curses.window.{instr,getstr}
Misc/NEWS.d/next/Library/2025-05-19-20-59-06.gh-issue-134209.anhTcF.rst
Outdated
Show resolved
Hide resolved
Ha. As I feared:
I suspect that the value being returned is not reliable for some reason. Unfortunately, we'll need to use |
add version changed message Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
add version changed message Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…nhTcF.rst 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>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
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 failin 8000 g. |
There was a problem hiding this comment.
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.
🤖 New build scheduled with the buildbot fleet by @picnixz for commit 6510d09 🤖 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. |
🤖 New build scheduled with the buildbot fleet by @picnixz for commit 6510d09 🤖 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. |
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! |
Thank you so much to guide me through the process! Glad that I'm able to contribute. |
…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 commit aadda87) 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>
GH-134391 is a backport of this pull request to the 3.14 branch. |
…,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 commit aadda87) 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>
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. |
…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` --------- 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>
Allocated curses buffer on heap and modified documentation to show this change.
_curses.window.{instr,getstr}
#134209📚 Documentation preview 📚: https://cpython-previews--134283.org.readthedocs.build/