bpo-36518: Store keyword arguments that matches passed positional arguments into varkw. by serhiy-storchaka · Pull Request #12674 · python/cpython
Expand Up
@@ -3858,15 +3858,15 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals,
/* Speed hack: do raw pointer compares. As names are
normally interned this should almost always hit. */
co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item;
for (j = 0; j < total_args; j++) {
for (j = (kwdict ? n : 0); j < total_args; j++) {
PyObject *name = co_varnames[j];
if (name == keyword) {
goto kw_found;
}
}
/* Slow fallback, just in case */ for (j = 0; j < total_args; j++) { for (j = (kwdict ? n : 0); j < total_args; j++) { PyObject *name = co_varnames[j]; int cmp = PyObject_RichCompareBool( keyword, name, Py_EQ); if (cmp > 0) { Expand Down
/* Slow fallback, just in case */ for (j = 0; j < total_args; j++) { for (j = (kwdict ? n : 0); j < total_args; j++) { PyObject *name = co_varnames[j]; int cmp = PyObject_RichCompareBool( keyword, name, Py_EQ); if (cmp > 0) { Expand Down