mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful error messages.
This commit is contained in:
parent
b5fc749c8b
commit
137507ea03
3 changed files with 14 additions and 7 deletions
|
@ -1562,8 +1562,7 @@ posix_spawnv(self, args)
|
|||
getitem = PyTuple_GetItem;
|
||||
}
|
||||
else {
|
||||
badarg:
|
||||
PyErr_BadArgument();
|
||||
PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1573,7 +1572,9 @@ posix_spawnv(self, args)
|
|||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue