mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-16 17:10:32 +03:00
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:
parent
43d779966b
commit
2a05aa2c43
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user