[issue9307] Py_TPFLAGS_LONG_SUBCLASS is not documented

Alexander Belopolsky report at bugs.python.org
Mon Jul 19 20:32:21 CEST 2010


Alexander Belopolsky <belopolsky at users.sourceforge.net> added the comment:

On Mon, Jul 19, 2010 at 2:17 PM, Antoine Pitrou <report at bugs.python.org> wrote:

> .. These flags are primarily useful for C extension developers, there's little point checking them from Python code.

Of course there is: it helps debugging problems in types implemented
in C.  For example, someone working on the numpy issue described in
msg110788, would probably appreciate having
inspect.TPFLAGS_INT_SUBCLASS and would probaly use it in his or hers
unit tests.

My point is: we have __flags__ attribute on type objects exposed in
python there should be a way to interpret what it means without
looking up object.h or C API documentation.

BTW, __flags__ itself could grow a docstring and deserves to be
mentioned in the docs.  Note that copyreg.py uses it to determine
wither a class is dynamically allocated.   Maybe this should also go
to inspect as inspect.isheaptype().

----------

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


More information about the Python-bugs-list mailing list