Move var setting into the only case using it

The original function was more complex than this. This refactoring
avoids a false positive in the static checker
This commit is contained in:
Daniele Varrazzo 2018-12-28 03:33:53 +01:00
parent 43d779966b
commit 2a05aa2c43

View File

@ -207,11 +207,6 @@ Bytes_Format(PyObject *format, PyObject *args)
"incomplete format");
goto error;
}
if (c != '%') {
v = getnextarg(args, arglen, &argidx);
if (v == NULL)
goto error;
}
switch (c) {
case '%':
pbuf = "%";
@ -219,6 +214,8 @@ Bytes_Format(PyObject *format, PyObject *args)
break;
case 's':
/* only bytes! */
if (!(v = getnextarg(args, arglen, &argidx)))
goto error;
if (!Bytes_CheckExact(v)) {
PyErr_Format(PyExc_ValueError,
"only bytes values expected, got %s",