Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 28740:d3297e298211 legacy-trunk
some more error-message enhancements
| author | Alex Martelli <aleaxit@gmail.com> |
|---|---|
| date | Wed, 23 Apr 2003 13:34:35 +0000 |
| parents | 52f3d90c17e8 |
| children | 0504ba8efbb6 af5535b0e009 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Wed Apr 23 13:12:19 2003 +0000 +++ b/Python/bltinmodule.c Wed Apr 23 13:34:35 2003 +0000 @@ -85,7 +85,7 @@ if (!PyTuple_Check(alist)) { if (!PySequence_Check(alist)) { PyErr_Format(PyExc_TypeError, - "apply() arg 2 expect sequence, found %s", + "apply() arg 2 expected sequence, found %s", alist->ob_type->tp_name); return NULL; } @@ -368,7 +368,7 @@ return NULL; if ((size_t)length != strlen(str)) { PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); + "compile() expected string without null bytes"); return NULL; } @@ -644,7 +644,7 @@ if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, - "attribute name must be string"); + "getattr(): attribute name must be string"); return NULL; } result = PyObject_GetAttr(v, name); @@ -700,7 +700,7 @@ if (!PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, - "attribute name must be string"); + "hasattr(): attribute name must be string"); return NULL; } v = PyObject_GetAttr(v, name); @@ -1556,11 +1556,11 @@ return NULL; if (fin == NULL) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdin"); + PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdin"); return NULL; } if (fout == NULL) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); + PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdout"); return NULL; } if (PyFile_SoftSpace(fout, 0)) { @@ -1601,7 +1601,7 @@ size_t len = strlen(s); if (len > INT_MAX) { PyErr_SetString(PyExc_OverflowError, - "input too long"); + "[raw_]input: input too long"); result = NULL; } else { @@ -1776,7 +1776,7 @@ if (d == NULL) { if (!PyErr_Occurred()) PyErr_SetString(PyExc_SystemError, - "no locals!?"); + "vars(): no locals!?"); } else Py_INCREF(d); @@ -1823,7 +1823,7 @@ /* reject string values for 'start' parameter */ if (PyObject_TypeCheck(result, &PyBaseString_Type)) { PyErr_SetString(PyExc_TypeError, - "can't sum strings [use ''.join(seq) instead]"); + "sum() can't sum strings [use ''.join(seq) instead]"); Py_DECREF(iter); return NULL; } @@ -2177,7 +2177,7 @@ tuple->ob_type->tp_as_sequence->sq_item) { item = tuple->ob_type->tp_as_sequence->sq_item(tuple, i); } else { - PyErr_SetString(PyExc_TypeError, "unsubscriptable object"); + PyErr_SetString(PyExc_TypeError, "filter(): unsubscriptable tuple"); goto Fail_1; } if (func == Py_None) {
