-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Expose functions called from the interpreter loop via PyAPI_FUNC #131776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Eh, I'm inclined to wait until people ask for them. Just exposing a bunch of internal, unstable functions with no users doesn't make much sense to me. At best, nobody will actually use them. At worst, people will start using them. :) |
If anything, it would be good to expose things in the unstable API rather than the private API. |
If you have a list of functions that would be useful to Cinder, please give the list :-) We may expose these functions in the unstable API, as @ZeroIntensity suggests. |
here's the list of functions where (a) cinder exposed them as
|
Hum, most of these functions are low-level and the internal C API is the right place for them. I'm not sure about adding PyAPI_FUNC() to them. For now, I would suggest to continue maintaining downstream patches on the Cinder fork to add these PyAPI_FUNC(). I'm not comfortable to add these functions to the public C API.
Compared to
I would prefer to not expose
You may reimplement these functions in Cinder, there are trivial: PyObject *
_PyNumber_PowerNoMod(PyObject *lhs, PyObject *rhs)
{
return PyNumber_Power(lhs, rhs, Py_None);
}
PyObject *
_PyNumber_InPlacePowerNoMod(PyObject *lhs, PyObject *rhs)
{
return PyNumber_InPlacePower(lhs, rhs, Py_None);
} |
Just to be clear, these would remain in the internal C API. |
yes, all we need is to be able to link against it, not any sort of stability guarantees. I like the idea of an alias of |
Rationale: JIT code often needs access to functions called from the interpreter loop (in
ceval.c
orbytecodes.c
), even if they are technically internal functions. gh-115802 is a good example - it addedPyAPI_FUNC
to a lot of functions inInclude/internal
.Cinder currently relies on a fork of 3.12 with a lot of new functions exposed; some but not all of these have also been exposed in 3.13+. As a start, I would like to send in a PR for the functions we have already needed to expose for cinder (e.g.
_PyNumber_InPlacePowerNoMod
), but more generally it might be useful to look at all thePy*
and_Py*
functions used directly in ceval or bytecodes and consider exposing them even if no specific JIT has needed them yet.The text was updated successfully, but these errors were encountered: