Mercurial > cpython-lru_cache-weakref
diff Objects/complexobject.c @ 19674:715244108faa legacy-trunk
Raise OverflowError when appropriate on long->float conversion. Most of
the fiddling is simply due to that no caller of PyLong_AsDouble ever
checked for failure (so that's fixing old bugs). PyLong_AsDouble is much
faster for big inputs now too, but that's more of a happy consequence
than a design goal.
| author | Tim Peters <tim.peters@gmail.com> |
|---|---|
| date | Tue, 04 Sep 2001 05:14:19 +0000 |
| parents | b3271297b984 |
| children | 2e6da2dd2ab8 |
line wrap: on
line diff
--- a/Objects/complexobject.c Tue Sep 04 03:51:09 2001 +0000 +++ b/Objects/complexobject.c Tue Sep 04 05:14:19 2001 +0000 @@ -522,6 +522,8 @@ } else if (PyLong_Check(*pw)) { cval.real = PyLong_AsDouble(*pw); + if (cval.real == -1.0 && PyErr_Occurred()) + return -1; *pw = PyComplex_FromCComplex(cval); Py_INCREF(*pv); return 0;
