[issue26824] Make some macros use Py_TYPE

Serhiy Storchaka report at bugs.python.org
Fri Apr 22 05:52:08 EDT 2016


Serhiy Storchaka added the comment:

Seems you misunderstood PEP3123. The bugs described in the PEP are gone and can't be reappear. The new PyObject_HEAD fixes the problem, it makes casting to PyObject* be defined behaviour. The accessor macros are needed only to write the code compatible with 3.x and 2.x. Without Py_TYPE() you would need to use `foo->ob_base->ob_type` or `foo->ob_type` in 3.x depending on the type of foo, and always use `foo->ob_type` in 2.x.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26824>
_______________________________________


More information about the Python-bugs-list mailing list