mirror of
https://github.com/python/cpython.git
synced 2025-12-10 02:50:09 +00:00
Set retval on PyOS_string_to_double failure.
This commit is contained in:
parent
4b841d9156
commit
51ae4921b3
1 changed files with 9 additions and 3 deletions
|
|
@ -699,8 +699,10 @@ r_object(RFILE *p)
|
|||
}
|
||||
buf[n] = '\0';
|
||||
dx = PyOS_string_to_double(buf, NULL, NULL);
|
||||
if (dx == -1.0 && PyErr_Occurred())
|
||||
if (dx == -1.0 && PyErr_Occurred()) {
|
||||
retval = NULL;
|
||||
break;
|
||||
}
|
||||
retval = PyFloat_FromDouble(dx);
|
||||
break;
|
||||
}
|
||||
|
|
@ -738,8 +740,10 @@ r_object(RFILE *p)
|
|||
}
|
||||
buf[n] = '\0';
|
||||
c.real = PyOS_string_to_double(buf, NULL, NULL);
|
||||
if (c.real == -1.0 && PyErr_Occurred())
|
||||
if (c.real == -1.0 && PyErr_Occurred()) {
|
||||
retval = NULL;
|
||||
break;
|
||||
}
|
||||
n = r_byte(p);
|
||||
if (n == EOF || r_string(buf, (int)n, p) != n) {
|
||||
PyErr_SetString(PyExc_EOFError,
|
||||
|
|
@ -749,8 +753,10 @@ r_object(RFILE *p)
|
|||
}
|
||||
buf[n] = '\0';
|
||||
c.imag = PyOS_string_to_double(buf, NULL, NULL);
|
||||
if (c.imag == -1.0 && PyErr_Occurred())
|
||||
if (c.imag == -1.0 && PyErr_Occurred()) {
|
||||
retval = NULL;
|
||||
break;
|
||||
}
|
||||
retval = PyComplex_FromCComplex(c);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue