summaryrefslogtreecommitdiffstats
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-04-26 14:00:08 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2009-04-26 14:00:08 (GMT)
commit944c6aedd08d10314988027fc53ccd4106af5091 (patch)
tree421acf7876e5d35b74de9f0767cc100a723f3a20 /Objects/complexobject.c
parentf254aab09891df400c305caa2ccd99ec448439a0 (diff)
downloadcpython-944c6aedd08d10314988027fc53ccd4106af5091.zip
cpython-944c6aedd08d10314988027fc53ccd4106af5091.tar.gz
cpython-944c6aedd08d10314988027fc53ccd4106af5091.tar.bz2
Reset errno before both calls to PyOS_ascii_strtod, not just one.
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index d1e9e92..ecf70da 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -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();