mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-06-06 06:03:12 +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");
|
"incomplete format");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (c != '%') {
|
|
||||||
v = getnextarg(args, arglen, &argidx);
|
|
||||||
if (v == NULL)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '%':
|
case '%':
|
||||||
pbuf = "%";
|
pbuf = "%";
|
||||||
|
@ -219,6 +214,8 @@ Bytes_Format(PyObject *format, PyObject *args)
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
/* only bytes! */
|
/* only bytes! */
|
||||||
|
if (!(v = getnextarg(args, arglen, &argidx)))
|
||||||
|
goto error;
|
||||||
if (!Bytes_CheckExact(v)) {
|
if (!Bytes_CheckExact(v)) {
|
||||||
PyErr_Format(PyExc_ValueError,
|
PyErr_Format(PyExc_ValueError,
|
||||||
"only bytes values expected, got %s",
|
"only bytes values expected, got %s",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user