Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 28604:eee4969adbae legacy-trunk
Prompted by Tim's comment, when handle_range_longs() sees an
unexpected type, report the actual type rather than 'float'. (It's
hard to even reach this code with a float. :-)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Mon, 14 Apr 2003 18:25:04 +0000 |
| parents | d2d232e2427b |
| children | 0792caa6371c |
line wrap: on
line diff
--- a/Python/bltinmodule.c Mon Apr 14 17:59:34 2003 +0000 +++ b/Python/bltinmodule.c Mon Apr 14 18:25:04 2003 +0000 @@ -1366,24 +1366,24 @@ Py_INCREF(istep); } - /* XXX What reason do we have to believe that if an arg isn't an - * XXX int, it must be a float? - */ if (!PyInt_Check(ilow) && !PyLong_Check(ilow)) { - PyErr_SetString(PyExc_ValueError, - "integer start argument expected, got float."); + PyErr_Format(PyExc_ValueError, + "integer start argument expected, got %s.", + ilow->ob_type->tp_name); goto Fail; } if (!PyInt_Check(ihigh) && !PyLong_Check(ihigh)) { - PyErr_SetString(PyExc_ValueError, - "integer end argument expected, got float."); + PyErr_Format(PyExc_ValueError, + "integer end argument expected, got %s.", + ihigh->ob_type->tp_name); goto Fail; } if (!PyInt_Check(istep) && !PyLong_Check(istep)) { - PyErr_SetString(PyExc_ValueError, - "integer step argument expected, got float."); + PyErr_Format(PyExc_ValueError, + "integer step argument expected, got %s.", + istep->ob_type->tp_name); goto Fail; }
