-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-133590: ensure that TableEntry.linenumber_borrow
is initialized
#133681
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 |
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 |
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.
One could argue that it's not an undefined behavior as linenumber_borrow
will always be set to something before it's read but accessing it while uninitialized is indeed UB.
Misc/NEWS.d/next/Core_and_Builtins/2025-05-08-18-21-59.gh-issue-133590.jsmXkD.rst
Outdated
Show resolved
Hide resolved
TableEntry.linenumber_borrow
is initialized
CI seems stuck. I'll close/reopen your PR. |
…lized (pythonGH-133681) (cherry picked from commit c838e21) Co-authored-by: Lauta <[email protected]>
GH-133872 is a backport of this pull request to the 3.14 branch. |
Since the author decided to initialize
filename_borrow
to NULL, I think thatlinenumber_borrow
should also be initialized (likely to 0).In its current state it could become an issue in the report_leak() function if for some reason
entry->linenumber_borrow = linenumber;
fails to be executed and then linenumber_borrow is accessed when filename_borrow is non-NULL. I'm not sure if this code path is possible at all, but initializing linenumber_borrow shouldn't have any side-effects.If this was left intentionally uninitialized for some reason, it would be a good idea to close this PR and open another one documenting the motive behind leaving it like this.
Also, stackrefs.c had a blank line at the beginning of the file (!!); I took the liberty to remove it.
linenumber_borrow
field of theTableEntry
struct #133590