[issue26824] Make some macros use Py_TYPE
Martin Panter
report at bugs.python.org
Fri Apr 22 03:45:36 EDT 2016
Martin Panter added the comment:
Most of Xiang’s changes are to Py<class>_Check() macros. I would expect them to be called with a generic PyObject pointer, and they do seem to be documented as accepting a PyObject pointer. Py_TYPE() is a macro that uses an unconditional cast. In general, these kinds of macros can hide errors that the compiler may otherwise pick up. E.g. if you accidentally pass an integer, or pointer to a pointer, etc, to Py_TYPE(), I think you will only get a warning or run-time crash, rather than a compile-time error. So while I am not that experienced with the C API, I suspect the change could have negative consequences.
----------
nosy: +martin.panter
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26824>
_______________________________________
More information about the Python-bugs-list
mailing list