Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 27484:5ba7934a7ba0 legacy-trunk
Fix SF bug# 676155, RuntimeWarning with tp_compare
Check return value of PyLong_AsDouble(), it can return an error.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Tue, 28 Jan 2003 19:21:24 +0000 |
| parents | f3a69037fdf0 |
| children | 17bfd5dbc0f1 |
line wrap: on
line diff
--- a/Objects/floatobject.c Tue Jan 28 18:22:35 2003 +0000 +++ b/Objects/floatobject.c Tue Jan 28 19:21:24 2003 +0000 @@ -629,7 +629,10 @@ return 0; } else if (PyLong_Check(*pw)) { - *pw = PyFloat_FromDouble(PyLong_AsDouble(*pw)); + double x = PyLong_AsDouble(*pw); + if (x == -1.0 && PyErr_Occurred()) + return -1; + *pw = PyFloat_FromDouble(x); Py_INCREF(*pv); return 0; }
