PEP 510: Add PyFunction_RemoveSpecialized() and PyFunction_RemoveAllSpecialized()
This commit is contained in:
parent
6ef0bf9566
commit
6b3a0c2970
36
pep-0510.txt
36
pep-0510.txt
|
@ -274,6 +274,8 @@ Changes to the Python C API:
|
||||||
* ``PyFunction_Specialize()``
|
* ``PyFunction_Specialize()``
|
||||||
* ``PyFunction_GetSpecializedCodes()``
|
* ``PyFunction_GetSpecializedCodes()``
|
||||||
* ``PyFunction_GetSpecializedCode()``
|
* ``PyFunction_GetSpecializedCode()``
|
||||||
|
* ``PyFunction_RemoveSpecialized()``
|
||||||
|
* ``PyFunction_RemoveAllSpecialized()``
|
||||||
|
|
||||||
None of these function and types are exposed at the Python level.
|
None of these function and types are exposed at the Python level.
|
||||||
|
|
||||||
|
@ -331,6 +333,9 @@ Add a specialized code structure::
|
||||||
Function methods
|
Function methods
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
PyFunction_Specialize
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Add a function method to specialize the function, add a specialized code
|
Add a function method to specialize the function, add a specialized code
|
||||||
with guards::
|
with guards::
|
||||||
|
|
||||||
|
@ -353,6 +358,10 @@ Result:
|
||||||
* Return ``1`` if the specialization has been ignored
|
* Return ``1`` if the specialization has been ignored
|
||||||
* Raise an exception and return ``-1`` on error
|
* Raise an exception and return ``-1`` on error
|
||||||
|
|
||||||
|
|
||||||
|
PyFunction_GetSpecializedCodes
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Add a function method to get the list of specialized codes::
|
Add a function method to get the list of specialized codes::
|
||||||
|
|
||||||
PyObject* PyFunction_GetSpecializedCodes(PyObject *func)
|
PyObject* PyFunction_GetSpecializedCodes(PyObject *func)
|
||||||
|
@ -361,7 +370,11 @@ Return a list of (*code*, *guards*) tuples where *code* is a callable or
|
||||||
code object and *guards* is a list of ``PyFuncGuard`` objects. Raise an
|
code object and *guards* is a list of ``PyFuncGuard`` objects. Raise an
|
||||||
exception and return ``NULL`` on error.
|
exception and return ``NULL`` on error.
|
||||||
|
|
||||||
Add a function method to get the specialized code::
|
|
||||||
|
PyFunction_GetSpecializedCode
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Add a function method checking guards to choose a specialized code::
|
||||||
|
|
||||||
PyObject* PyFunction_GetSpecializedCode(PyObject *func,
|
PyObject* PyFunction_GetSpecializedCode(PyObject *func,
|
||||||
PyObject **stack,
|
PyObject **stack,
|
||||||
|
@ -371,6 +384,27 @@ See ``check()`` function of guards for *stack*, *na* and *nk* arguments.
|
||||||
Return a callable or a code object on success. Raise an exception and
|
Return a callable or a code object on success. Raise an exception and
|
||||||
return ``NULL`` on error.
|
return ``NULL`` on error.
|
||||||
|
|
||||||
|
|
||||||
|
PyFunction_RemoveSpecialized
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Add a function method to remove a specialized code with its guards by
|
||||||
|
its index::
|
||||||
|
|
||||||
|
int PyFunction_RemoveSpecialized(PyObject *func, Py_ssize_t index)
|
||||||
|
|
||||||
|
Return ``0`` on sucess. Raise an exception and return ``-1`` on error.
|
||||||
|
|
||||||
|
|
||||||
|
PyFunction_RemoveAllSpecialized
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Add a function method to remove all specialized codes and guards of a
|
||||||
|
function::
|
||||||
|
|
||||||
|
void PyFunction_RemoveAllSpecialized(PyObject *func)
|
||||||
|
|
||||||
|
|
||||||
Benchmark
|
Benchmark
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue