Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
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)
}
}
else {
- PyErr_BadArgument();
+ PyErr_Format(PyExc_TypeError,
+ "must assign list (not \"%.200s\") to slice",
+ v->ob_type->tp_name);
return -1;
}
if (ilow < 0)
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)
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)