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)
}
}
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)
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;
}
getitem = PyTuple_GetItem;
}
else {
- badarg:
- PyErr_BadArgument();
+ PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
return NULL;
}
for (i = 0; i < argc; i++) {
if (!PyArg_Parse((*getitem)(argv, i), "s", &argvlist[i])) {
PyMem_DEL(argvlist);
- goto badarg;
+ PyErr_SetString(PyExc_TypeError,
+ "all arguments must be strings");
+ return NULL;
}
}
argvlist[argc] = NULL;
if (args == NULL || !PyTuple_Check(args) ||
(n = PyTuple_Size(args)) < 1)
{
- PyErr_BadArgument();
+ PyErr_SetString(PyExc_TypeError,
+ "struct.pack requires at least one argument");
return NULL;
}
format = PyTuple_GetItem(args, 0);