[issue39573] Make PyObject an opaque structure in the limited C API

STINNER Victor report at bugs.python.org
Fri Feb 7 04:55:12 EST 2020


STINNER Victor <vstinner at python.org> added the comment:

Would a Py_TYPE_IS() macro help code readability?

For example:
    #define Future_CheckExact(obj) (Py_TYPE(obj) == &FutureType)
would become:
    #define Future_CheckExact(obj) (Py_TYPE_IS(obj, &FutureType))

Py_TYPE_IS() would be more efficient for tagged pointers.

I'm not sure about the macro name. Neil used Py_IS_TYPE(obj, type).

Note: Py_TYPE_EQ(obj, type) name sounds confusing since the first parameter is an object, whereas the second one is a type.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39573>
_______________________________________


More information about the Python-bugs-list mailing list