STINNER Victor added the comment:

Here is a first patch:

* Add _PyObject_FastCallKeywords(): main entry point
* Add _PyCFunction_FastCallKeywords(): implementation for C function, but 
currently it's just an empty skeleton
* Rename fast_function() to PyFunction_FastCallKeywords() and ajust its API

In this first implementation, _PyObject_FastCallKeywords() has a full 
implementation for Python function, otherwise it only uses 
_PyObject_FastCallDict() fast path if the function has no keyword argument. In 
the last resort, it creates a temporary tuple and maybe also a temporary dict, 
to call PyObject_Call().

To test the patch, I modified do_call() to call _PyObject_FastCallKeywords(). 
I'm not sure that it makes sense in term of performance at this stage.

Serhiy: You can use this first implementation to experimental for fast argument 
parser for keyword arguments passed as (key, value) pairs ;-)

----------
keywords: +patch
Added file: http://bugs.python.org/file44191/fastcall_keywords.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27830>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to