GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-105107: Remove PyEval_CallFunction() function by vstinner · Pull Request #105108 · python/cpython

gh-105107: Remove PyEval_CallFunction() function #105108

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.

Sign up for GitHub

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
vstinner merged 3 commits into python:main from vstinner:remove_pyeval_call
May 31, 2023

Uh oh!

There was an error while loading. Please reload this page.

Merged

gh-105107: Remove PyEval_CallFunction() function #105108

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
a394bbc
gh-105107: Remove PyEval_CallFunction() function
vstinner May 30, 2023
70301a1
Fix typo
vstinner May 31, 2023
3a3980f
Complete the doc
vstinner May 31, 2023
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

3 changes: 0 additions & 3 deletions 3 Doc/data/stable_abi.dat
Show comments
View file
Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

15 changes: 15 additions & 0 deletions 15 Doc/whatsnew/3.13.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -308,3 +308,18 @@ Deprecated
Removed
-------

* Remove functions deprecated in Python 3.9.

* ``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use
:c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead.
Warning: :c:func:`PyObject_Call` positional arguments must be a
:class:`tuple` and must not be *NULL*, keyword arguments must be a
:class:`dict` or *NULL*, whereas removed functions checked arguments type
and accepted *NULL* positional and keyword arguments.
To replace ``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with
:c:func:`PyObject_Call`, pass an empty tuple as positional arguments using
:c:func:`PyTuple_New(0) <PyTuple_New>`.
* ``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead.
* ``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead.

(Contributed by Victor Stinner in :gh:`105107`.)
21 changes: 0 additions & 21 deletions 21 Include/ceval.h
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,6 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co,
PyObject *const *defs, int defc,
PyObject *kwdefs, PyObject *closure);

/* PyEval_CallObjectWithKeywords(), PyEval_CallObject(), PyEval_CallFunction
* and PyEval_CallMethod are deprecated. Since they are officially part of the
* stable ABI (PEP 384), they must be kept for backward compatibility.
* PyObject_Call(), PyObject_CallFunction() and PyObject_CallMethod() are
* recommended to call a callable object.
*/

Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
PyObject *callable,
PyObject *args,
PyObject *kwargs);

/* Deprecated since PyEval_CallObjectWithKeywords is deprecated */
#define PyEval_CallObject(callable, arg) \
PyEval_CallObjectWithKeywords((callable), (arg), _PyObject_CAST(_Py_NULL))

Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallFunction(
PyObject *callable, const char *format, ...);
Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallMethod(
PyObject *obj, const char *name, const char *format, ...);

PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void);
PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void);
PyAPI_FUNC(PyObject *) PyEval_GetLocals(void);
Expand Down
9 changes: 9 additions & 0 deletions 9 Misc/NEWS.d/next/C API/2023-05-30-19-11-09.gh-issue-105107.YQwMnm.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Remove functions deprecated in Python 3.9.

* ``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use
:c:func:`PyObject_CallNoArgs` and :c:func:`PyObject_Call` (positional
arguments must not be *NULL*) instead.
* ``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead.
* ``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead.

Patch by Victor Stinner.
3 changes: 3 additions & 0 deletions 3 Misc/stable_abi.toml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,13 @@
added = '3.2'
[function.PyEval_CallFunction]
added = '3.2'
abi_only = true
[function.PyEval_CallMethod]
added = '3.2'
abi_only = true
[function.PyEval_CallObjectWithKeywords]
added = '3.2'
abi_only = true
[function.PyEval_EvalCode]
added = '3.2'
[function.PyEval_EvalCodeEx]
Expand Down
15 changes: 7 additions & 8 deletions 15 Objects/call.c
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,9 @@ _PyFunction_Vectorcall(PyObject *func, PyObject* const* stack,
/* --- More complex call functions -------------------------------- */

/* External interface to call any callable object.
The args must be a tuple or NULL. The kwargs must be a dict or NULL. */
PyObject *
The args must be a tuple or NULL. The kwargs must be a dict or NULL.
Function removed in Python 3.13 API but kept in the stable ABI. */
PyAPI_FUNC(PyObject*)
PyEval_CallObjectWithKeywords(PyObject *callable,
PyObject *args, PyObject *kwargs)
{
Expand Down Expand Up @@ -583,9 +584,8 @@ PyObject_CallFunction(PyObject *callable, const char *format, ...)


/* PyEval_CallFunction is exact copy of PyObject_CallFunction.
* This function is kept for backward compatibility.
*/
PyObject *
Function removed in Python 3.13 API but kept in the stable ABI. */
PyAPI_FUNC(PyObject*)
PyEval_CallFunction(PyObject *callable, const char *format, ...)
{
va_list va;
Expand Down Expand Up @@ -656,9 +656,8 @@ PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)


/* PyEval_CallMethod is exact copy of PyObject_CallMethod.
* This function is kept for backward compatibility.
*/
PyObject *
Function removed in Python 3.13 API but kept in the stable ABI. */
PyAPI_FUNC(PyObject*)
PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...)
{
PyThreadState *tstate = _PyThreadState_GET();
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.