summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e269106..2c5274a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1343,8 +1343,12 @@ posix_execv(self, args)
getitem = PyTuple_GetItem;
}
else {
- badarg:
- PyErr_BadArgument();
+ PyErr_SetString(PyExc_TypeError, "argv must be tuple or list");
+ return NULL;
+ }
+
+ if (argc == 0) {
+ PyErr_SetString(PyExc_ValueError, "empty argument list");
return NULL;
}
@@ -1354,7 +1358,10 @@ posix_execv(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;
@@ -1416,6 +1423,12 @@ posix_execve(self, args)
return NULL;
}
+ if (argc == 0) {
+ PyErr_SetString(PyExc_ValueError,
+ "empty argument list");
+ return NULL;
+ }
+
argvlist = PyMem_NEW(char *, argc+1);
if (argvlist == NULL) {
PyErr_NoMemory();