Skip to content
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

C API: Remove deprecate PyEval_CallObject() function #105107

Closed
vstinner opened this issue May 30, 2023 · 3 comments
Closed

C API: Remove deprecate PyEval_CallObject() function #105107

vstinner opened this issue May 30, 2023 · 3 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@vstinner
Copy link
Member

vstinner commented May 30, 2023

The Python C API has many functions to call a function or a method: https://docs.python.org/dev/c-api/call.html

The PyEval variants were deprecated in Python 3.9. I propose to now remove them:

  • PyEval_CallObject()
  • PyEval_CallObjectWithKeywords()
  • PyEval_CallFunction()
  • PyEval_CallMethod()

There are replacement functions like PyObject_Call() and PyObject_CallFunction() which exist since Python 3.0 at least and so is backward compatible.

Linked PRs

@vstinner vstinner added the type-bug An unexpected behavior, bug, or error label May 30, 2023
vstinner added a commit to vstinner/cpython that referenced this issue May 30, 2023
Remove 4 functions from the C API, deprecated in Python 3.9:

* PyEval_CallObjectWithKeywords()
* PyEval_CallObject()
* PyEval_CallFunction()
* PyEval_CallMethod()

Keep 3 functions in the stable ABI:

* PyEval_CallObjectWithKeywords()
* PyEval_CallFunction()
* PyEval_CallMethod()
vstinner added a commit to vstinner/cpython that referenced this issue May 30, 2023
Remove 4 functions from the C API, deprecated in Python 3.9:

* PyEval_CallObjectWithKeywords()
* PyEval_CallObject()
* PyEval_CallFunction()
* PyEval_CallMethod()

Keep 3 functions in the stable ABI:

* PyEval_CallObjectWithKeywords()
* PyEval_CallFunction()
* PyEval_CallMethod()
@vstinner
Copy link
Member Author

There are replacement functions like PyObject_Call() and PyObject_CallFunction() which exist since Python 3.0 at least and so is backward compatible.

Replacing PyEval_CallObject(func, args) with PyObject_Call(args) does crash if args is NULL. Python 3.9 added PyObject_CallNoArgs() for this purpose: https://docs.python.org/dev/c-api/call.html#c.PyObject_CallNoArgs

@vstinner
Copy link
Member Author

The PyEval_Call*() functions are not documented and not tested.

vstinner added a commit to vstinner/cpython that referenced this issue May 31, 2023
Remove 4 functions from the C API, deprecated in Python 3.9:

* PyEval_CallObjectWithKeywords()
* PyEval_CallObject()
* PyEval_CallFunction()
* PyEval_CallMethod()

Keep 3 functions in the stable ABI:

* PyEval_CallObjectWithKeywords()
* PyEval_CallFunction()
* PyEval_CallMethod()
vstinner added a commit that referenced this issue May 31, 2023
Remove 4 functions from the C API, deprecated in Python 3.9:

* PyEval_CallObjectWithKeywords()
* PyEval_CallObject()
* PyEval_CallFunction()
* PyEval_CallMethod()

Keep 3 functions in the stable ABI:

* PyEval_CallObjectWithKeywords()
* PyEval_CallFunction()
* PyEval_CallMethod()
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
vstinner added a commit to vstinner/cpython that referenced this issue Jun 1, 2023
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
@vstinner
Copy link
Member Author

vstinner commented Jun 1, 2023

I also removed the PyCFunction_Call() function.

vstinner added a commit that referenced this issue Jun 1, 2023
* Keep the function in the stable ABI.
* Add unit tests on PyCFunction_Call() since it remains supported in
  the stable ABI.
shadchin added a commit to shadchin/tensorflow that referenced this issue Jul 20, 2024
python/cpython#105107 Remove deprecate PyEval_CallObject() function.

> There are replacement functions like PyObject_Call() and PyObject_CallFunction() which exist since Python 3.0 at least and so is backward compatible.
jimbob88 added a commit to jimbob88/pybfd3 that referenced this issue Sep 17, 2024
PyEval_CallObject was deprecated in Py39 and has now been removed.

See: python/cpython#105107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant