-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-111178: fix UBSan failures in Modules/_interp*module.c
#129779
Open
picnixz
wants to merge
10
commits into
python:main
Choose a base branch
from
picnixz:fix/ubsan/interp-111178
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+52
−44
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
be385ff
remove redundant casts in `Modules/_interpchannelsmodule.c`
picnixz ae33ded
suppress unused return values in `Modules/_interpchannelsmodule.c`
picnixz 712953d
suppress unused return values in `Modules/_interpqueuesmodule.c`
picnixz 7dad552
fix UBSan failures for `XIBufferViewObject`
picnixz 81d2315
suppress unused return values in `Modules/_interpretersmodule.c`
picnixz baee622
Merge remote-tracking branch 'upstream/main' into fix/ubsan/interp-11…
picnixz d4483e0
do not use the macro when the type is already checked
picnixz e2ee75e
fix compilation
picnixz 2794f87
Do not add an underscore to the macro if none is needed.
picnixz 9c6f69c
Do Do not use `_` + capital letter in new code as it is also UB.
picnixz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
I like this way better, but I'm curious: if we use a
CAST
macro for other objects, why do we use the standard style forPyObject
?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.
I use macros when a possible assertion can be added later. For objects known to be of correct type, a fast raw cast is kept.
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.
Note: one exception when calling the
clear
function in thefree
function of module objects. We started using raw casts there so I kept that convention and didn't touch anything. But technically, we could also use the macro to assert that the object being passed is a PyObject and not just something else.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.
Note 2: In general, we use
op
for the PyObject value andself
for the csated one. Ideally, I wanted to useself
for the PyObject one andthis
for the casted one, but this would result in lots of changes. And it could also conflict with thethis
in C++ for IDEs so I resisted against this kind of convention.If I could change the entire code base, I would likely use that convention though but
op/self
is also fine (note that most of the time I wanted to minimize the diff, so even if there are inconsistencies in the parameter names, I tried to keep the diff smaller rather than having more inconsistencies if by any chance there are other functions that are left untouched).