Author: Tobias Pape <tob...@netshed.de> Branch: popen-pclose Changeset: r69709:ba703e79044d Date: 2014-03-04 12:18 +0100 http://bitbucket.org/pypy/pypy/changeset/ba703e79044d/
Log: Exit status masking is not done by close but by its caller diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py --- a/rpython/rlib/rfile.py +++ b/rpython/rlib/rfile.py @@ -119,7 +119,9 @@ """Closes the described file. Attention! Unlike Python semantics, `close' does not return `None' upon - success but `0', to be able to return an exit code for popen'ed files + success but `0', to be able to return an exit code for popen'ed files. + + The actual return value may be determined with os.WEXITSTATUS. """ ll_f = self.ll_file res = 0 @@ -130,7 +132,7 @@ if res == -1: errno = rposix.get_errno() raise OSError(errno, os.strerror(errno)) - return os.WEXITSTATUS(res) + return res _do_close = staticmethod(c_close) # overridden in RPopenFile diff --git a/rpython/rlib/test/test_rfile.py b/rpython/rlib/test/test_rfile.py --- a/rpython/rlib/test/test_rfile.py +++ b/rpython/rlib/test/test_rfile.py @@ -206,7 +206,7 @@ s = f.read() r = f.close() assert s == "%s\n" % printval - assert r == retval + assert os.WEXITSTATUS(r) == retval class TestPopenR(BaseRtypingTest): def setup_class(cls): @@ -234,4 +234,4 @@ assert s == "%s\n" % printval return f.close() r = self.interpret(f, []) - assert r == retval + assert os.WEXITSTATUS(r) == retval _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit