[pypy-svn] r75696 - in pypy/branch/fast-forward/pypy/module/posix: . test
benjamin at codespeak.net
benjamin at codespeak.net
Wed Jun 30 20:55:45 CEST 2010
Author: benjamin
Date: Wed Jun 30 20:55:43 2010
New Revision: 75696
Modified:
pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
pypy/branch/fast-forward/pypy/module/posix/test/test_posix2.py
Log:
apparently execv must have at least one arg
Modified: pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/posix/interp_posix.py (original)
+++ pypy/branch/fast-forward/pypy/module/posix/interp_posix.py Wed Jun 30 20:55:43 2010
@@ -550,8 +550,12 @@
path: path of executable file
args: iterable of strings
"""
+ args_w = space.unpackiterable(w_args)
+ if len(args_w) < 1:
+ w_msg = space.wrap("execv() must have at least one argument")
+ raise OperationError(space.w_ValueError, w_msg)
try:
- os.execv(command, [space.str_w(i) for i in space.unpackiterable(w_args)])
+ os.execv(command, [space.str_w(w_arg) for w_arg in args_w])
except OperationError, e:
if not e.match(space, space.w_TypeError):
raise
Modified: pypy/branch/fast-forward/pypy/module/posix/test/test_posix2.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/posix/test/test_posix2.py (original)
+++ pypy/branch/fast-forward/pypy/module/posix/test/test_posix2.py Wed Jun 30 20:55:43 2010
@@ -349,6 +349,10 @@
os = self.posix
raises(OSError, 'os.execv("saddsadsadsadsa", ["saddsadsasaddsa"])')
+ def test_execv_no_args(self):
+ os = self.posix
+ raises(ValueError, os.execv, "notepad", [])
+
def test_execv_raising2(self):
os = self.posix
def t(n):
More information about the Pypy-commit
mailing list