]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Michael Hudson <mwh21@cam.ac.uk>:
authorFred Drake <fdrake@acm.org>
Thu, 1 Jun 2000 03:12:13 +0000 (03:12 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 1 Jun 2000 03:12:13 +0000 (03:12 +0000)
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.

Objects/listobject.c
Objects/stringobject.c
Objects/tupleobject.c

index f70d19bdf1157bd1415cbbcfd619823cafcf3d8b..661a53bc559452ba5c9d0107cf72eb509a1b059a 100644 (file)
@@ -388,7 +388,9 @@ list_concat(a, bb)
        int i;
        PyListObject *np;
        if (!PyList_Check(bb)) {
-               PyErr_BadArgument();
+               PyErr_Format(PyExc_TypeError,
+                            "can only append list (not \"%.200s\") to list",
+                            bb->ob_type->tp_name);
                return NULL;
        }
 #define b ((PyListObject *)bb)
@@ -469,7 +471,9 @@ list_ass_slice(a, ilow, ihigh, v)
                }
        }
        else {
-               PyErr_BadArgument();
+               PyErr_Format(PyExc_TypeError,
+                            "must assign list (not \"%.200s\") to slice",
+                            v->ob_type->tp_name);
                return -1;
        }
        if (ilow < 0)
index f17fbf1a062ec69f3d9590c461a6ad0293546e29..ce6548b6f64d044081d4c6005c333476fd6f7dcd 100644 (file)
@@ -293,7 +293,9 @@ string_concat(a, bb)
        if (!PyString_Check(bb)) {
                if (PyUnicode_Check(bb))
                    return PyUnicode_Concat((PyObject *)a, bb);
-               PyErr_BadArgument();
+               PyErr_Format(PyExc_TypeError, 
+                            "cannot add type \"%.200s\" to string",
+                            bb->ob_type->tp_name);
                return NULL;
        }
 #define b ((PyStringObject *)bb)
index d5d6a079eff39e2fed2ecad2154245fc653bca9a..c26b7dfbf0deefb893d5e276e605180e74e18371 100644 (file)
@@ -361,7 +361,9 @@ tupleconcat(a, bb)
        register int i;
        PyTupleObject *np;
        if (!PyTuple_Check(bb)) {
-               PyErr_BadArgument();
+               PyErr_Format(PyExc_TypeError,
+                            "can only append tuple (not \"%.200s\") to tuple",
+                            bb->ob_type->tp_name);
                return NULL;
        }
 #define b ((PyTupleObject *)bb)