On Fri, Jun 14, 2019 at 12:29 AM Jeroen Demeyer J.Demeyer@ugent.be wrote:
I think that the opposite is true actually: the reason that people access internals is because there is no public API doing what they want. Having more public API should *reduce* the need for accessing internals.
For example, _PyObject_GetMethod is not public API but it's useful functionality. So Cython is forced to reinvent _PyObject_GetMethod (i.e. copy verbatim that function from the CPython sources), which requires accessing internals.
This became off topic... but.
In case of _PyObject_GetMethod, I agree that it means we don't provide *some* useful API. But it doesn't mean _PyObject_GetMethod is the missing useful API.
We don't provide method calling API which uses optimization same to LOAD_METHOD. Which may be like this:
/* methname is Unicode, nargs > 0, and args is self. */ PyObject_VectorCallMethod(PyObject *methname, PyObject **args, Py_ssize_t nargs, PyObject *kwds)
(Would you try adding this? Or may I?)
Anyway, do you think _PyObject_GetMethod is useful even after we provide PyObject_VectorCallMethod ?
I'd like to put _PyObject_GetMethod in private/ (with PyAPI_FUNC) in 3.9, for users like Cython.
If you want to make it public in 3.9, please create new thread. Let's discuss about how it is useful, and current name and signature are good enough to make it public.