Hello,
I've opened a GitHub issue to discuss the design of HPy's support for
calling Python functions --
https://github.com/hpyproject/hpy/issues/122.
Feedback & comments would be most welcome.
TL;DR:
The current proposal is to implement:
HPy HPy_Call(HPyContext ctx, HPy callable, HPy args, HPy kwargs)
// inspired by PyObject_Call
and
HPy HPy_CallArray(HPyContext ctx, HPy *args, HPy_ssize_t nargs, const
char **kwnames, HPy *kwargs)
// inspired by our experience with HPyArg_ParseKeywords and
PyObject_VectorcallDict.
Along with HPyCallable_Check and later HPy_CallMethod and HPy_CallMethodArray.
Feedback now will prevent me from having to recode or fix things later
(but feedback later is okay too).
Yours sincerely,
Simon Cross
Hi,
I would like to discuss evolutions of the C API in CPython. I propose
to meet next monday (November 16) at 10:00 on Zoom:
Zoom URL: https://oracle.zoom.us/j/339127822?pwd=YkNZbFgvdXZ4Z3NlcWg1N3BlZ3JTUT09
Meeting ID: 339 127 822
Password: 237729
I'm trying to "bend" the C API towards HPy, but I'm facing different
issues. Other CPython core devs basically suggest that I leave the C
API as it is: "developers will continue to use the old C API since
it's not going to move away anytime soon" :-(
In my latest attempt, I proposed to add new functions which only use
regular strong refs, don't steal references and avoid borrowed
references:
https://bugs.python.org/issue42294
For example, add PyTuple_GetItemRef() which returns a strong reference.
I also added "borrowed reference" and "strong reference" to the Python
documentation glossary. I was surprised that there was no definition
of that previously!
https://docs.python.org/dev/glossary.html#term-strong-reference
I also enhanced the Reference Counting documentation:
https://docs.python.org/dev/c-api/refcounting.html
See also:
* PEP 620 "Hide implementation details from the C API" which is related:
https://www.python.org/dev/peps/pep-0620/
* My notes on "bad C API":
https://pythoncapi.readthedocs.io/bad_api.html
See you monday!
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.