Mercurial > cpython-lru_cache-weakref
diff Modules/arraymodule.c @ 12814:b1b260a2de98 legacy-trunk
Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Thu, 01 Jun 2000 02:02:46 +0000 |
| parents | 1c7c2dd1beb1 |
| children | 705132667f7b |
line wrap: on
line diff
--- a/Modules/arraymodule.c Thu Jun 01 01:17:17 2000 +0000 +++ b/Modules/arraymodule.c Thu Jun 01 02:02:46 2000 +0000 @@ -540,7 +540,9 @@ int size; arrayobject *np; if (!is_arrayobject(bb)) { - PyErr_BadArgument(); + PyErr_Format(PyExc_TypeError, + "can only append array (not \"%.200s\") to array", + bb->ob_type->tp_name); return NULL; } #define b ((arrayobject *)bb) @@ -613,7 +615,9 @@ } } else { - PyErr_BadArgument(); + PyErr_Format(PyExc_TypeError, + "can only assign array (not \"%.200s\") to array slice", + v->ob_type->tp_name); return -1; } if (ilow < 0) @@ -821,7 +825,8 @@ char tmp[sizeof(double)]; /* Assume that's the max item size */ if (args != NULL) { - PyErr_BadArgument(); + PyErr_SetString(PyExc_TypeError, + "<array>.reverse requires exactly 0 arguments"); return NULL; }
