bpo-1635741 port _testbuffer to multi-phase init by koubaa · Pull Request #22003 · python/cpython

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shihai1991 @vstinner I am trying to convert the NDArray_Type to a heap type but it has binary functions in its as_mapping that need access to the module state, e.g.:

nd = (NDArrayObject *)ndarray_new(&NDArray_Type, NULL, NULL);

The signature of this method is:

static PyObject *
ndarray_subscript(NDArrayObject *self, PyObject *key)

There doesn't seem to be a way to get the module in this case - so I believe converting to heap types might block until a future PEP. Please correct me if I am wrong but I will proceed with using PyModule_AddType without heap types.