Open hoodmane opened 3 months ago
_Py_HashBytes -- use Python utility function for hashing my stuff rather than reimplement
The API was approved but not implemented: https://github.com/capi-workgroup/decisions/issues/13
Some of these should have a public alternative. (Maybe already evaluated some of these and found a reason to not use them?)
_PyArg_CheckPositional
Argument Clinic is private itself. But, if you run it with --limited
, it'll keep to the limited (and thus public) API. (And the replacement for _PyArg_CheckPositional
even hardcodes some things that the function determines at runtime!)
_PyLong_AsByteArray
/_PyLong_FromByteArray
/_PyLong_NumBits
There is now PyLong_AsNativeBytes
/PyLong_FromNativeBytes
.
The As
also serve the _PyLong_NumBits
use case (and if you can optimistically give it a small buffer, only huge integers will need two calls)
_PyNumber_Index
You can use tp_as_number->nb_index
, and type-check the result yourself.
Note that returning int subtypes from nb_index
(or __index__
) is deprecated.
_PySet_Update
Call PyNumber_InPlaceOr
, or tp_as_number->nb_inplace_or
. (Assuming you don't mind that subclasses can override this.)
_PyUnicode_EQ
I created https://github.com/python/cpython/issues/124502 to add PyUnicode_Equal()
function.
_Py_HashBytes -- use Python utility function for hashing my stuff rather than reimplement
Py_HashBuffer() was added to Python 3.14: https://docs.python.org/dev/c-api/hash.html#c.Py_HashBuffer
Here is the list of the private C APIs used by Pyodide. I tried to drop ones that have public equivalents on the main branch, but I may have accidentally kept some.
cc @vstinner
Argument parsing
Argument parsing for vectorcall, would be nice to have argument clinic variant for these I guess?
Errors and tracebacks
Generators
Hashes
Numbers
Other data structures
Miscellaneous
PyIter_Check
PyID functions
I could easily shim these; Pyodide is single threaded so they are nice.