[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API
Erlend Egeberg Aasland
report at bugs.python.org
Mon Feb 15 15:33:52 EST 2021
Erlend Egeberg Aasland <erlend.aasland at innova.no> added the comment:
After GH-24533 and GH-24535, there's (AFAICS) only a handful of cases left.
$ grep -r "\->tp_" Include/:
Include/internal/pycore_abstract.h: PyNumberMethods *tp_as_number = Py_TYPE(obj)->tp_as_number;
Include/internal/pycore_interp.h: unsigned int version; // initialized from type->tp_version_tag
Include/internal/pycore_object.h: return ((type->tp_flags & feature) != 0);
Include/internal/pycore_object.h: Py_ssize_t offset = Py_TYPE(op)->tp_weaklistoffset;
Include/internal/pycore_object.h: && (Py_TYPE(obj)->tp_is_gc == NULL
Include/internal/pycore_object.h: || Py_TYPE(obj)->tp_is_gc(obj)));
Include/cpython/pyerrors.h:#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name)
Include/cpython/abstract.h: offset = tp->tp_vectorcall_offset;
Include/cpython/abstract.h: ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) )
Include/cpython/object.h: ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize))
Include/cpython/objimpl.h:#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize )
Include/cpython/objimpl.h: _Py_SIZE_ROUND_UP((typeobj)->tp_basicsize + \
Include/cpython/objimpl.h: (nitems)*(typeobj)->tp_itemsize, \
Include/cpython/objimpl.h:#define PyType_SUPPORTS_WEAKREFS(t) ((t)->tp_weaklistoffset > 0)
Include/object.h: flags = type->tp_flags;
Should we strive to fix the cases in Include/internal as well?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40170>
_______________________________________
More information about the Python-bugs-list
mailing list