Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3k Changeset: r58985:5e8ec66b5218 Date: 2012-11-18 18:43 +0100 http://bitbucket.org/pypy/pypy/changeset/5e8ec66b5218/
Log: Fixes in _posixsubprocess module. diff --git a/pypy/module/_posixsubprocess/interp_subprocess.py b/pypy/module/_posixsubprocess/interp_subprocess.py --- a/pypy/module/_posixsubprocess/interp_subprocess.py +++ b/pypy/module/_posixsubprocess/interp_subprocess.py @@ -29,7 +29,7 @@ threadsafe=True) c_cloexec_pipe = rffi.llexternal( 'pypy_subprocess_cloexec_pipe', - [rffi.CArrayPtr(rffi.LONG)], rffi.INT, + [rffi.CArrayPtr(rffi.INT)], rffi.INT, compilation_info=eci, threadsafe=True) @@ -112,7 +112,7 @@ # These conversions are done in the parent process to avoid allocating # or freeing memory in the child process. try: - exec_array = [space.bytes_w(w_item) + exec_array = [space.bytes0_w(w_item) for w_item in space.listview(w_executable_list)] l_exec_array = rffi.liststr2charpp(exec_array) @@ -122,7 +122,7 @@ l_argv = rffi.liststr2charpp(argv) if not space.is_none(w_env_list): - envp = [space.bytes_w(w_item) + envp = [space.bytes0_w(w_item) for w_item in space.listview(w_env_list)] l_envp = rffi.liststr2charpp(envp) @@ -193,7 +193,7 @@ """"cloexec_pipe() -> (read_end, write_end) Create a pipe whose ends have the cloexec flag set.""" - with lltype.scoped_alloc(rffi.CArrayPtr(rffi.LONG).TO, 2) as fds: + with lltype.scoped_alloc(rffi.CArrayPtr(rffi.INT).TO, 2) as fds: res = c_cloexec_pipe(fds) if res != 0: raise exception_from_errno(space, space.w_OSError) diff --git a/pypy/module/_posixsubprocess/test/test_subprocess.py b/pypy/module/_posixsubprocess/test/test_subprocess.py new file mode 100644 --- /dev/null +++ b/pypy/module/_posixsubprocess/test/test_subprocess.py @@ -0,0 +1,13 @@ +class AppTestSubprocess: + spaceconfig = dict(usemodules=('_posixsubprocess',)) + + # XXX write more tests + + def test_cloexec_pipe(self): + import _posixsubprocess, os + fd1, fd2 = _posixsubprocess.cloexec_pipe() + # Sanity checks + assert 0 <= fd1 < 4096 + assert 0 <= fd2 < 4096 + os.close(fd1) + os.close(fd2) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit