]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Reset errno before both calls to PyOS_ascii_strtod, not just one.
authorMark Dickinson <dickinsm@gmail.com>
Sun, 26 Apr 2009 14:00:08 +0000 (14:00 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Sun, 26 Apr 2009 14:00:08 +0000 (14:00 +0000)
Objects/complexobject.c

index d1e9e9209906bcf5e9b5ea16e32f6e59a7f9f29f..ecf70dacfdc4233703103b9b67fe8a550bf07719 100644 (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();