diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-08-22 21:17:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-08-22 21:17:30 (GMT) |
commit | 6fea7f7ffc5ca840e4d54b5777669129b8ee6276 (patch) | |
tree | 53211ea1c5fc7cede5c2d0be03fc775c36cd7ae3 /Python | |
parent | b9009391868f739f4ddf09fa04061f6af05228b3 (diff) | |
download | cpython-6fea7f7ffc5ca840e4d54b5777669129b8ee6276.zip cpython-6fea7f7ffc5ca840e4d54b5777669129b8ee6276.tar.gz cpython-6fea7f7ffc5ca840e4d54b5777669129b8ee6276.tar.bz2 |
Issue #27809: Cleanup _PyEval_EvalCodeWithName()
* Rename nm to name
* PEP 7: add { ... } to if/else blocks
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d656fab..9c65937 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3878,28 +3878,28 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, normally interned this should almost always hit. */ co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item; for (j = 0; j < total_args; j++) { - PyObject *nm = co_varnames[j]; - if (nm == keyword) + PyObject *name = co_varnames[j]; + if (name == keyword) { goto kw_found; + } } /* Slow fallback, just in case */ for (j = 0; j < total_args; j++) { - PyObject *nm = co_varnames[j]; - int cmp = PyObject_RichCompareBool( - keyword, nm, Py_EQ); - if (cmp > 0) + PyObject *name = co_varnames[j]; + int cmp = PyObject_RichCompareBool( keyword, name, Py_EQ); + if (cmp > 0) { goto kw_found; - else if (cmp < 0) + } + else if (cmp < 0) { goto fail; + } } if (j >= total_args && kwdict == NULL) { PyErr_Format(PyExc_TypeError, - "%U() got an unexpected " - "keyword argument '%S'", - co->co_name, - keyword); + "%U() got an unexpected keyword argument '%S'", + co->co_name, keyword); goto fail; } @@ -3911,10 +3911,8 @@ _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, kw_found: if (GETLOCAL(j) != NULL) { PyErr_Format(PyExc_TypeError, - "%U() got multiple " - "values for argument '%S'", - co->co_name, - keyword); + "%U() got multiple values for argument '%S'", + co->co_name, keyword); goto fail; } Py_INCREF(value); |