[pypy-svn] pypy fast-forward: os.popen().close() should return None when the command exits with a zero status.
amauryfa
commits-noreply at bitbucket.org
Wed Jan 12 01:35:56 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: fast-forward
Changeset: r40614:bd3399dae06a
Date: 2011-01-12 01:36 +0100
http://bitbucket.org/pypy/pypy/changeset/bd3399dae06a/
Log: os.popen().close() should return None when the command exits with a
zero status.
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -413,7 +413,7 @@
stream = os.popen('echo 1')
res = stream.read()
assert res == '1\n'
- stream.close()
+ assert stream.close() is None
if hasattr(__import__(os.name), '_getfullpathname'):
def test__getfullpathname(self):
diff --git a/pypy/module/posix/app_posix.py b/pypy/module/posix/app_posix.py
--- a/pypy/module/posix/app_posix.py
+++ b/pypy/module/posix/app_posix.py
@@ -113,8 +113,9 @@
pid = self._childpid
if pid is not None:
self._childpid = None
- return os.waitpid(pid, 0)[1]
- return 0
+ sts = os.waitpid(pid, 0)[1]
+ if sts != 0:
+ return sts
__del__ = close # as in CPython, __del__ may call os.waitpid()
def popen(command, mode='r', bufsize=-1):
More information about the Pypy-commit
mailing list