[Python-checkins] peps: PEP 510: Add PyFunction_RemoveSpecialized() and

victor.stinner python-checkins at python.org
Thu Jan 14 03:50:30 EST 2016


https://hg.python.org/peps/rev/04b071bdb4c1
changeset:   6181:04b071bdb4c1
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jan 14 09:50:22 2016 +0100
summary:
  PEP 510: Add PyFunction_RemoveSpecialized() and PyFunction_RemoveAllSpecialized()

files:
  pep-0510.txt |  36 +++++++++++++++++++++++++++++++++++-
  1 files changed, 35 insertions(+), 1 deletions(-)


diff --git a/pep-0510.txt b/pep-0510.txt
--- a/pep-0510.txt
+++ b/pep-0510.txt
@@ -274,6 +274,8 @@
   * ``PyFunction_Specialize()``
   * ``PyFunction_GetSpecializedCodes()``
   * ``PyFunction_GetSpecializedCode()``
+  * ``PyFunction_RemoveSpecialized()``
+  * ``PyFunction_RemoveAllSpecialized()``
 
 None of these function and types are exposed at the Python level.
 
@@ -331,6 +333,9 @@
 Function methods
 ----------------
 
+PyFunction_Specialize
+^^^^^^^^^^^^^^^^^^^^^
+
 Add a function method to specialize the function, add a specialized code
 with guards::
 
@@ -353,6 +358,10 @@
 * Return ``1`` if the specialization has been ignored
 * Raise an exception and return ``-1`` on error
 
+
+PyFunction_GetSpecializedCodes
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 Add a function method to get the list of specialized codes::
 
     PyObject* PyFunction_GetSpecializedCodes(PyObject *func)
@@ -361,7 +370,11 @@
 code object and *guards* is a list of ``PyFuncGuard`` objects. Raise an
 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 **stack,
@@ -371,6 +384,27 @@
 Return a callable or a code object on success. Raise an exception and
 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
 ---------
 

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list