[issue34838] Improve arg clinic code generation for cases with type checking

Ammar Askar report at bugs.python.org
Mon Oct 1 14:26:20 EDT 2018


Ammar Askar <ammar at ammaraskar.com> added the comment:

I've attached a PR that implements this. From the looks of it, there aren't a lot of uses of subclass_of within argument clinic converted functions at the moment. Additionally, most of the places it is used tend to have some non object arguments so a call to _PyArg_ParseStack() gets placed anyway.

Attached as part of separate commit in the PR is the conversion of some files over to use the new code. These are mostly just to serve as examples. 

While converting would still leave a call to ParseStack in most places, I'd like to do some benchmarking and figure out if there is still a benefit. Like you said, the fact that branch-prediction is easier might be useful given that these functions are usually called with the right types of arguments anyway.

----------
nosy: +ammar2
stage: patch review -> 

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34838>
_______________________________________


More information about the Python-bugs-list mailing list