mirror of https://github.com/python/cpython
PyFloat_FromString(): Move s_buffer[] up to the top-level function
scope. Previously, s_buffer[] was defined inside the PyUnicode_Check() scope, but referred to in the outer scope via assignment to s. This quiets an Insure portability warning.
This commit is contained in:
parent
dc55d715bb
commit
67c1a04bbb
|
@ -133,6 +133,7 @@ PyFloat_FromString(PyObject *v, char **pend)
|
||||||
const char *s, *last, *end;
|
const char *s, *last, *end;
|
||||||
double x;
|
double x;
|
||||||
char buffer[256]; /* For errors */
|
char buffer[256]; /* For errors */
|
||||||
|
char s_buffer[256];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
if (PyString_Check(v)) {
|
if (PyString_Check(v)) {
|
||||||
|
@ -140,8 +141,6 @@ PyFloat_FromString(PyObject *v, char **pend)
|
||||||
len = PyString_GET_SIZE(v);
|
len = PyString_GET_SIZE(v);
|
||||||
}
|
}
|
||||||
else if (PyUnicode_Check(v)) {
|
else if (PyUnicode_Check(v)) {
|
||||||
char s_buffer[256];
|
|
||||||
|
|
||||||
if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) {
|
if (PyUnicode_GET_SIZE(v) >= sizeof(s_buffer)) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"float() literal too large to convert");
|
"float() literal too large to convert");
|
||||||
|
|
Loading…
Reference in New Issue