* complete PyFunction_Specialize() description
* add link to the implementation
This commit is contained in:
Victor Stinner 2016-01-13 15:16:46 +01:00
parent 3981ab06d2
commit 90c260b907
1 changed files with 18 additions and 0 deletions

View File

@ -342,6 +342,16 @@ with guards::
int PyFunction_Specialize(PyObject *func,
PyObject *code, PyObject *guards)
If *code* is a Python function, the code object of the *code* function
is used as the specialized code. The specialized Python function must
have the same parameter defaults, the same keyword parameter defaults,
and must not have specialized code.
If *code* is a Python function or a code object, a new code object is
created and the code name and first number number of the code object of
*func* are copied. The specialized code must have the same cell
variables and the same free variables.
Result:
* Return ``0`` on success
@ -379,6 +389,14 @@ According to this microbenchmark, the changes has no overhead on calling
a Python function without specialization.
Implementation
==============
The `issue #26098: PEP 510: Specialize functions with guards
<http://bugs.python.org/issue26098>`_ contains a patch which implements
this PEP.
Other implementations of Python
===============================