bpo-41746: Fix CHECK macros to not do type erasure#22786
bpo-41746: Fix CHECK macros to not do type erasure#22786lysnikolaou wants to merge 1 commit intopython:masterfrom
Conversation
|
@gvanrossum @pablogsal One question on this: In the macro |
pablogsal
left a comment
There was a problem hiding this comment.
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