From: Stefan Behnel Date: Wed, 28 Jul 2010 07:50:38 +0000 (+0200) Subject: fix performance hit in argument unpacking when passing keyword arguments into functio... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1792fbdf12f971014b7450adc01df50dc26a88d3;p=cython.git fix performance hit in argument unpacking when passing keyword arguments into functions that have both required positional and optional keyword arguments --- diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 03b593fd..6069072c 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2647,10 +2647,10 @@ class DefNode(FuncDefNode): if arg.kw_only: # handled separately below continue - code.putln('if (kw_args > %d) {' % num_required_args) + code.putln('if (kw_args > 0) {') code.putln('PyObject* value = PyDict_GetItem(%s, %s);' % ( Naming.kwds_cname, pystring_cname)) - code.putln('if (unlikely(value)) { values[%d] = value; kw_args--; }' % i) + code.putln('if (value) { values[%d] = value; kw_args--; }' % i) code.putln('}') else: num_required_args -= 1