-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-133157: remove usage of _Py_NO_SANITIZE_UNDEFINED
in pyexpat
#135346
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
base: main
Are you sure you want to change the base?
Conversation
…pat` Co-Authored-By: Bénédikt Tran <[email protected]>
I think it's a clean alternative and doesn't need C11 (though I'm not entirely sure my solution needs C11). At least, your solution doesn't. |
Co-authored-by: Bénédikt Tran <[email protected]>
@@ -110,9 +114,7 @@ struct HandlerInfo { | |||
|
|||
static struct HandlerInfo handler_info[64]; | |||
|
|||
// gh-111178: Use _Py_NO_SANITIZE_UNDEFINED, rather than using the exact | |||
// handler API for each handler. |
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 think you can remove the macro as it was the last place. Or we can keep for future hotfixes. Although jt was recently added in pyport.h (or pymacro.h I don't remember), it could have been used in downstream projects even if it's private.
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.
Ah, good catch. We can just remove it; if it's needed we can dig it up from Git history.
I did add a blurb
so if it causes an error somewhere, people can find it in the changelog.
AFAIK, to avoid undefined behavior, a function needs to be called via a function pointer of the correct type.
For storage, it can be cast to any other function type. It just needs to be cast back, when retrieved.
So, we should be able to avoid the union in #134050... but not C function for each setter (or at least one for each type, but
SETTER_WRAPPER
seems clearer).@picnixz: I didn't test this all the way; will continue tomorrow