-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
bpo-41746: Fix CHECK macros to not do type erasure #22786
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
@gvanrossum @pablogsal One question on this: In the macro |
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.
Unfortunately, this does not work because the ternary operator deduces the type as void*
. From the C99 standard:
since C does not have a type hierarchy for pointer types, pointer operands may only be used if they are of the same type (ignoring type qualifiers) or one is void or NULL.
When you're done making the requested changes, leave the comment: |
The grammar needs to be fixed as well. If you substitute the macro for an identity:
you will start to see these errors:
The reason these errors are not present now is that the macros pass |
I'm closing this. |
Why? |
In a chat I had with @pablogsal, he explained to me why this doesn't work. Basically the different pointer types will get cast to Bottom line is we should probably discuss this a bit more. Another idea Pablo mentioned is to pass the type to the macro in the generator level, but that hardly seems feasible for nested call to |
Hm, it's just a bit of work, we should just do it. |
Opened #22864. |
https://bugs.python.org/issue41746