Reset errno before both calls to PyOS_ascii_strtod, not just one.

This commit is contained in:
Mark Dickinson 2009-04-26 14:00:08 +00:00
parent f254aab098
commit 944c6aedd0
1 changed files with 2 additions and 2 deletions

View File

@ -911,8 +911,6 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
return NULL;
}
errno = 0;
/* position on first nonblank */
start = s;
while (*s && isspace(Py_CHARMASK(*s)))
@ -947,6 +945,7 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
*/
/* first look for forms starting with <float> */
errno = 0;
z = PyOS_ascii_strtod(s, &end);
if (end == s && errno == ENOMEM)
return PyErr_NoMemory();
@ -959,6 +958,7 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
if (*s == '+' || *s == '-') {
/* <float><signed-float>j | <float><sign>j */
x = z;
errno = 0;
y = PyOS_ascii_strtod(s, &end);
if (end == s && errno == ENOMEM)
return PyErr_NoMemory();