You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PEP proposes an interface for use by extension modules.
51
+
Such interfaces cannot effectively be tested, or designed, without having the
52
+
consumers in the loop.
53
+
For that reason, we provide private (underscore-prefixed) names.
54
+
The API may change (based on consumer feedback) in Python 3.9, where we expect
55
+
it to be finalized, and the underscores removed.
56
+
47
57
48
58
Specification
49
59
=============
@@ -65,12 +75,12 @@ Changes to the ``PyTypeObject`` struct
65
75
--------------------------------------
66
76
67
77
The unused slot ``printfunc tp_print`` is replaced with ``tp_vectorcall_offset``. It has the type ``Py_ssize_t``.
68
-
A new ``tp_flags`` flag is added, ``Py_TPFLAGS_HAVE_VECTORCALL``,
78
+
A new ``tp_flags`` flag is added, ``_Py_TPFLAGS_HAVE_VECTORCALL``,
69
79
which must be set for any class that uses the vectorcall protocol.
70
80
71
-
If ``Py_TPFLAGS_HAVE_VECTORCALL`` is set, then ``tp_vectorcall_offset`` must be a positive integer.
81
+
If ``_Py_TPFLAGS_HAVE_VECTORCALL`` is set, then ``tp_vectorcall_offset`` must be a positive integer.
72
82
It is the offset into the object of the vectorcall function pointer of type ``vectorcallfunc``.
73
-
This pointer may be ``NULL``, in which case the behavior is the same as if ``Py_TPFLAGS_HAVE_VECTORCALL`` was not set.
83
+
This pointer may be ``NULL``, in which case the behavior is the same as if ``_Py_TPFLAGS_HAVE_VECTORCALL`` was not set.
74
84
75
85
The ``tp_print`` slot is reused as the ``tp_vectorcall_offset`` slot to make it easier for for external projects to backport the vectorcall protocol to earlier Python versions.
76
86
In particular, the Cython project has shown interest in doing that (see https://mail.python.org/pipermail/python-dev/2018-June/153927.html).
@@ -80,7 +90,7 @@ Descriptor behavior
80
90
81
91
One additional type flag is specified: ``Py_TPFLAGS_METHOD_DESCRIPTOR``.
82
92
83
-
``Py_TPFLAGS_METHOD_DESCRIPTOR`` should be set if the the callable uses the descriptor protocol to create a bound method-like object.
93
+
``Py_TPFLAGS_METHOD_DESCRIPTOR`` should be set if the callable uses the descriptor protocol to create a bound method-like object.
84
94
This is used by the interpreter to avoid creating temporary objects when calling methods
85
95
(see ``_PyObject_GetMethod`` and the ``LOAD_METHOD``/``CALL_METHOD`` opcodes).
86
96
@@ -128,7 +138,7 @@ New C API and changes to CPython
128
138
129
139
The following functions or macros are added to the C API:
0 commit comments