10000 bpo-39245: Switch to public API for Vectorcall by encukou · Pull Request #18460 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-39245: Switch to public API for Vectorcall #18460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clean-up
- Revert changes to in docs & news
- Revert changes to backcompat defines in headers
- Nudge misaligned comments
  • Loading branch information
encukou committed Feb 11, 2020
commit fb6b10443610d595408b59da6d5270823c54a364
10 changes: 5 additions & 5 deletions Doc/c-api/call.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ function as with any other callable.

In CPython 3.8, the vectorcall API and related functions were available
provisionally under names with a leading underscore:
``PyObject_Vectorcall``, ``Py_TPFLAGS_HAVE_VECTORCALL``,
``PyObject_VectorcallMethod``, ``PyVectorcall_Function``,
``PyObject_CallOneArg``, ``PyObject_CallMethodNoArgs``,
``PyObject_CallMethodOneArg``.
``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``,
``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``,
``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``,
``_PyObject_CallMethodOneArg``.
Additionally, ``PyObject_VectorcallDict`` was available as
``PyObject_VectorcallDict``.
``_PyObject_FastCallDict``.
The old names are still defined as aliases of the new, non-underscored names.


Expand Down
14 changes: 7 additions & 7 deletions Include/cpython/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ PyObject_Vectorcall(PyObject *callable, PyObject *const *args,
}

// Backwards compatibility aliases for API that was provisional in Python 3.8
#define PyObject_Vectorcall PyObject_Vectorcall
#define PyObject_VectorcallMethod PyObject_VectorcallMethod
#define PyObject_VectorcallDict PyObject_VectorcallDict
#define PyVectorcall_Function PyVectorcall_Function
#define PyObject_CallOneArg PyObject_CallOneArg
#define PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs
#define PyObject_CallMethodOneArg PyObject_CallMethodOneArg
#define _PyObject_Vectorcall PyObject_Vectorcall
#define _PyObject_VectorcallMethod PyObject_VectorcallMethod
#define _PyObject_FastCallDict PyObject_VectorcallDict
#define _PyVectorcall_Function PyVectorcall_Function
#define _PyObject_CallOneArg PyObject_CallOneArg
#define _PyObject_CallMethodNoArgs PyObject_CallMethodNoArgs
#define _PyObject_CallMethodOneArg PyObject_CallMethodOneArg

/* Same as PyObject_Vectorcall except that keyword arguments are passed as
dict, which may be NULL if there are no keyword arguments. */
Expand Down
2 changes: 1 addition & 1 deletion Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ given type object has a specified feature.
#ifndef Py_LIMITED_API
#define Py_TPFLAGS_HAVE_VECTORCALL (1UL << 11)
// Backwards compatibility alias for API that was provisional in Python 3.8
#define Py_TPFLAGS_HAVE_VECTORCALL Py_TPFLAGS_HAVE_VECTORCALL
#define _Py_TPFLAGS_HAVE_VECTORCALL Py_TPFLAGS_HAVE_VECTORCALL
#endif

/* Set if the type is 'ready' -- fully initialized */
Expand Down
8 changes: 4 additions & 4 deletions Misc/NEWS.d/3.9.0a1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ The :keyword:`assert` statement now works properly if the

Removed object cache (``free_list``) for bound method objects. Temporary
bound method objects are less used than before thanks to the ``LOAD_METHOD``
opcode and the ``PyObject_VectorcallMethod`` C API.
opcode and the ``_PyObject_VectorcallMethod`` C API.

..

Expand Down Expand Up @@ -5676,7 +5676,7 @@ Exclude Python-ast.h, ast.h and asdl.h from the limited API.
.. nonce: vftT4f
.. section: C API

Add new function ``PyObject_CallOneArg`` for calling an object with one
Add new function ``_PyObject_CallOneArg`` for calling an object with one
positional argument.

..
Expand All @@ -5696,8 +5696,8 @@ Add :func:`PyConfig_SetWideStringList` function.
.. section: C API

Add fast functions for calling methods:
:c:func:`PyObject_VectorcallMethod`, :c:func:`PyObject_CallMethodNoArgs`
and :c:func:`PyObject_CallMethodOneArg`.
:c:func:`_PyObject_VectorcallMethod`, :c:func:`_PyObject_CallMethodNoArgs`
and :c:func:`_PyObject_CallMethodOneArg`.

..

Expand Down
2 changes: 1 addition & 1 deletion Modules/_functoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static PyTypeObject partial_type = {
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE |
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
partial_doc, /* tp_doc */
(traverseproc)partial_traverse, /* tp_traverse */
0, /* tp_clear */
Expand Down
2 changes: 1 addition & 1 deletion Objects/classobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ PyTypeObject PyMethod_Type = {
PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
method_doc, /* tp_doc */
(traverseproc)method_traverse, /* tp_traverse */
0, /* tp_clear */
Expand Down
2 changes: 1 addition & 1 deletion Objects/methodobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ PyTypeObject PyCFunction_Type = {
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
0, /* tp_doc */
(traverseproc)meth_traverse, /* tp_traverse */
0, /* tp_clear */
Expand Down
2 changes: 1 addition & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3665,7 +3665,7 @@ PyTypeObject PyType_Type = {
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS |
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
Py_TPFLAGS_HAVE_VECTORCALL, /* tp_flags */
type_doc, /* tp_doc */
(traverseproc)type_traverse, /* tp_traverse */
(inquiry)type_clear, /* tp_clear */
Expand Down
0