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 vstinner
Recipients methane, serhiy.storchaka, vstinner
Date 2017-02-09.00:17:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Subset of the (almost) rejected issue #29259 (tp_fastcall), attached patch adds _PyMethod_FastCall() and uses it in call_method() of typeobject.c. The change avoids the creation of a temporary tuple for Python functions and METH_FASTCALL C functions.

Currently, call_method() calls method_call() which calls _PyObject_Call_Prepend(), and calling method_call() requires a tuple for positional arguments.

Example of benchmark on __getitem__(): 1.3x faster (-22%).

$ ./python -m perf timeit -s 'class C:' -s ' def __getitem__(self, index): return index' -s 'c=C()' 'c[0]' 

Median +- std dev: 130 ns +- 1 ns => 102 ns +- 1 ns

See also the issue #29263 "Implement LOAD_METHOD/CALL_METHOD for C functions".
Date User Action Args
2017-02-09 00:17:38vstinnersetrecipients: + vstinner, methane, serhiy.storchaka
2017-02-09 00:17:38vstinnersetmessageid: <>
2017-02-09 00:17:38vstinnerlinkissue29507 messages
2017-02-09 00:17:38vstinnercreate