-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-111178: fix UBSan failures in Modules/_functoolsmodule.c
#129778
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
In addition, change `_PyPartialObject_CAST` to `partialobject_CAST` as `_` + capital letter is UB.
@@ -145,7 +145,7 @@ typedef struct { | |||
} partialobject; | |||
|
|||
// cast a PyObject pointer PTR to a partialobject pointer (no type checks) | |||
#define _PyPartialObject_CAST(PTR) ((partialobject *)(PTR)) | |||
#define partialobject_CAST(op) ((partialobject *)(op)) |
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.
There' no need to change existing macros, especially ones with the _Py
prefix that's de-facto reserved for Python.
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.
Err actually this is something I probably wrote recently so I thought it would have been better to make it consistent at least. I can revert it though (I think that's my code because there is a PTR and this is something I used before Victor told me to use "op")
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.
Oh, right, it's from #124733 from October
This PR fixes the UBSan failures and addresses some minor cosmetic changes. PEP-7 changes were not applied since they could scramble the diff but other semantic changes affecting the signature of touched functions may have been done.