mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Issue #5829: don't raise OverflowError for complex('1e500'). Backport of r72803.
This commit is contained in:
parent
ac2380b58a
commit
a4e0efa4b1
3 changed files with 11 additions and 9 deletions
|
|
@ -989,8 +989,6 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
|
|||
z = PyOS_ascii_strtod(s, &end);
|
||||
if (end == s && errno == ENOMEM)
|
||||
return PyErr_NoMemory();
|
||||
if (errno == ERANGE && fabs(z) >= 1.0)
|
||||
goto overflow;
|
||||
|
||||
if (end != s) {
|
||||
/* all 4 forms starting with <float> land here */
|
||||
|
|
@ -1002,8 +1000,6 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
|
|||
y = PyOS_ascii_strtod(s, &end);
|
||||
if (end == s && errno == ENOMEM)
|
||||
return PyErr_NoMemory();
|
||||
if (errno == ERANGE && fabs(y) >= 1.0)
|
||||
goto overflow;
|
||||
if (end != s)
|
||||
/* <float><signed-float>j */
|
||||
s = end;
|
||||
|
|
@ -1063,11 +1059,6 @@ complex_subtype_from_string(PyTypeObject *type, PyObject *v)
|
|||
PyErr_SetString(PyExc_ValueError,
|
||||
"complex() arg is a malformed string");
|
||||
return NULL;
|
||||
|
||||
overflow:
|
||||
PyErr_SetString(PyExc_OverflowError,
|
||||
"complex() arg overflow");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue