This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author lemburg
Recipients lemburg, mark.dickinson, methane, serhiy.storchaka, vstinner
Date 2017-02-14.09:06:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487063213.05.0.267809174976.issue29548@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks, but you missed the main difference:

The argument tuple can be NULL for PyEval_CallObject() (it then gets replaced with an empty tuple), but will raise a segfault for PyObject_Call().

Now, apart from looking at the use cases in the core, you also have to check whether you are removing useful functionality when deprecating APIs. Code in third party extensions may not be that easy to adapt to the PyObject_Call*() APIs, since they lack several checks which the PyEval_Call*() APIs apply.

Deprecation of existing published APIs is only an option in case there are other APIs which can reasonably replace them and those other APIs would have to have been around for a while, since otherwise third party code would have to provide wrappers for Python versions which don't supply these APIs or only ones which do not implement the extra functionality.

E.g. if you now add the extra support for args being NULL to PyObject_Call() in Python 3.7, third party code would have to either switch being using PyEval_CallObject() and PyObject_Call() depending on Python version or provide its own wrappers around the two APIs depending on Python version.

Since calling objects is rather common in Python extensions, special care has to be taken.

It would have been better to add the special case for args == NULL and the extra types checks to PyObject_Call() a long long time ago, since it's the only API that allows calling an object with both args and kwargs. Alas, didn't happen, so we have to live with it.

It may actually be better to add a new API PyObject_CallObjectWithKeywords() which works like the PyEval_CallObjectWithKeywords() API and then deprecate the PyEval_COWK() API. Third party code can then use a simple macro to provide a backwards compatibility shim for older Python versions.
History
Date User Action Args
2017-02-14 09:06:53lemburgsetrecipients: + lemburg, mark.dickinson, vstinner, methane, serhiy.storchaka
2017-02-14 09:06:53lemburgsetmessageid: <1487063213.05.0.267809174976.issue29548@psf.upfronthosting.co.za>
2017-02-14 09:06:53lemburglinkissue29548 messages
2017-02-14 09:06:51lemburgcreate