[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

INADA Naoki report at bugs.python.org
Wed Feb 1 20:17:26 EST 2017


INADA Naoki added the comment:

LOAD_METHOD support was based on tp_fastcall.

Without LOAD_METHOD support, methoddescr_get is called and
stack layout after LOAD_METHOD is:

  NULL, (bound)PyCFunction, arg1, arg2, ... argN

With LOAD_METHOD support, stack layout is:

  PyMethodDescrObject, self, arg1, ... argN

And tp_call (or tp_fastcall) of method descriptor is called when CALL_METHOD.

Without tp_fastcall, it means pack&unpack tuple happens.
It is more heavy than creating temporary PyCFunction.

---

Other ideas to support LOAD_METHOD for C function are:

* Add _PyMethodDescr_FastCallKeywords and call it in call_function.
* Create unbound PyCFunction and cache it

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29263>
_______________________________________


More information about the Python-bugs-list mailing list