[issue47164] [C API] Add private "CAST" macros to clean up casts in C code
STINNER Victor
report at bugs.python.org
Wed Mar 30 11:07:13 EDT 2022
STINNER Victor <vstinner at python.org> added the comment:
> I've had to debug a segfault before only because the inline function implicitly cast its arguments, and it was accessing a non-existent member. If it were a macro it would access the struct member directly, and the compiler would be able to catch that and warn me before runtime.
This is part of Python C API legacy and as I wrote, it's not going to change soon. The minor enhancement that we can do is to inject an assertion when Python is built in debug mode.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47164>
_______________________________________
More information about the Python-bugs-list
mailing list