Commit 1792fbdf authored by Stefan Behnel's avatar Stefan Behnel

fix performance hit in argument unpacking when passing keyword arguments into...

fix performance hit in argument unpacking when passing keyword arguments into functions that have both required positional and optional keyword arguments
parent ba750d10
...@@ -2647,10 +2647,10 @@ class DefNode(FuncDefNode): ...@@ -2647,10 +2647,10 @@ class DefNode(FuncDefNode):
if arg.kw_only: if arg.kw_only:
# handled separately below # handled separately below
continue continue
code.putln('if (kw_args > %d) {' % num_required_args) code.putln('if (kw_args > 0) {')
code.putln('PyObject* value = PyDict_GetItem(%s, %s);' % ( code.putln('PyObject* value = PyDict_GetItem(%s, %s);' % (
Naming.kwds_cname, pystring_cname)) 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('}') code.putln('}')
else: else:
num_required_args -= 1 num_required_args -= 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment