[issue40601] [C API] Hide static types from the limited C API

Guido van Rossum report at bugs.python.org
Wed Mar 24 11:59:37 EDT 2021


Guido van Rossum <guido at python.org> added the comment:

FWIW I have an idea that would allow code using e.g. &PyList_Type to continue to work, and even ABI compatible (though only in the main interpreter).

// In some header file

PyAPI_FUNC(PyHeapTypeObject *) PyList_GetType();

#define PyList_Type (PyList_GetType()->ht_type)

For the main interpreter we could make this return the address of PyList_Type.

----------
nosy: +gvanrossum

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


More information about the Python-bugs-list mailing list