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.11:00:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <27a13fa7-3a57-3514-cb6e-2a1603906a9c@egenix.com>
In-reply-to <1487067389.18.0.5784746708.issue29548@psf.upfronthosting.co.za>
Content
On 14.02.2017 11:16, STINNER Victor wrote:
> 
>> Please note that the two sets of APIs are not identical, e.g. you cannot simply replace PyEval_CallObject() with PyObject_Call(), since the former applies a few extra checks and defaults, which the latter doesn't.
> 
> IMHO these checks are too expensive at runtime for little benefit. If you pass non-tuple to PyObject_Call(), Python immediately crash. You are immediately noticied of the bug :-) I don't think that such bugs are common enough to justify the overhead.

From the design of the abstract API layer, it is rather
uncommon to have these not do extra checks to prevent segfaults.
They were originally designed to be safe and developer friendly.

OTOH, the PyEval_* APIs were designed to be fast, only for people
who know what they are doing and for interpreter internals.

Historically, this design approach appears to have been swapped
somewhere between Python 2.1 and 2.2 for the call APIs,
which is unfortunate.

So from a design perspective, it would be better to have the
abstract APIs again do proper checks and leave the low level,
"segfault protected" :-) call APIs around as PyEval_Call*()
or better yet: not make them public at all.

> Any idea of the popularity of the undocumented PyEval_xxx() functions? Are they used by Cython for example? By a single random extension module in the world?

Well, I know that our eGenix extensions are using them
and there are quite a few hits on github as well:

https://github.com/search?utf8=%E2%9C%93&q=PyEval_CallObjectWithKeywords&type=Code&ref=searchresults

> I'm more in favor of modifying PyEval_xxx() to call PyObject_xxx() and deprecate them.
History
Date User Action Args
2017-02-14 11:00:44lemburgsetrecipients: + lemburg, mark.dickinson, vstinner, methane, serhiy.storchaka
2017-02-14 11:00:44lemburglinkissue29548 messages
2017-02-14 11:00:44lemburgcreate