[pypy-svn] r78752 - in pypy/branch/fast-forward/pypy/module/posix: . test
afa at codespeak.net
afa at codespeak.net
Fri Nov 5 16:41:51 CET 2010
Author: afa
Date: Fri Nov 5 16:41:49 2010
New Revision: 78752
Modified:
pypy/branch/fast-forward/pypy/module/posix/__init__.py
pypy/branch/fast-forward/pypy/module/posix/interp_posix.py
pypy/branch/fast-forward/pypy/module/posix/test/test_posix2.py
Log:
Expose posix.spawnv, on Windows at least.
It was already implemented in ll_os.py, I don't know why the posix module was forgotten...
Modified: pypy/branch/fast-forward/pypy/module/posix/__init__.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/posix/__init__.py (original)
+++ pypy/branch/fast-forward/pypy/module/posix/__init__.py Fri Nov 5 16:41:49 2010
@@ -102,6 +102,8 @@
interpleveldefs['execv'] = 'interp_posix.execv'
if hasattr(os, 'execve'):
interpleveldefs['execve'] = 'interp_posix.execve'
+ if hasattr(posix, 'spawnv'):
+ interpleveldefs['spawnv'] = 'interp_posix.spawnv'
if hasattr(os, 'uname'):
interpleveldefs['uname'] = 'interp_posix.uname'
if hasattr(os, 'sysconf'):
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 Fri Nov 5 16:41:49 2010
@@ -714,6 +714,15 @@
raise wrap_oserror(space, e)
execve.unwrap_spec = [ObjSpace, str, W_Root, W_Root]
+def spawnv(space, mode, path, w_args):
+ args = [space.str_w(w_arg) for w_arg in space.unpackiterable(w_args)]
+ try:
+ ret = os.spawnv(mode, path, args)
+ except OSError, e:
+ raise wrap_oserror(space, e)
+ return space.wrap(ret)
+spawnv.unwrap_spec = [ObjSpace, int, str, W_Root]
+
def utime(space, w_path, w_tuple):
""" utime(path, (atime, mtime))
utime(path, None)
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 Fri Nov 5 16:41:49 2010
@@ -65,6 +65,7 @@
cls.w_sysconf_value = space.wrap(os.sysconf_names[sysconf_name])
cls.w_sysconf_result = space.wrap(os.sysconf(sysconf_name))
cls.w_SIGABRT = space.wrap(signal.SIGABRT)
+ cls.w_python = space.wrap(sys.executable)
def setup_method(self, meth):
if getattr(meth, 'need_sparse_files', False):
@@ -375,6 +376,15 @@
os.unlink("onefile")
pass # <- please, inspect.getsource(), don't crash
+ if hasattr(__import__(os.name), "spawnv"):
+ def test_spawnv(self):
+ os = self.posix
+ import sys
+ print self.python
+ ret = os.spawnv(os.P_WAIT, self.python,
+ ['python', '-c', 'raise(SystemExit(42))'])
+ assert ret == 42
+
def test_popen(self):
os = self.posix
for i in range(5):
More information about the Pypy-commit
mailing list