[Python-checkins] cpython (3.6): Issue #26935: Fix broken Android dup2() in test_os
xavier.degaye
python-checkins at python.org
Wed Nov 16 02:07:14 EST 2016
https://hg.python.org/cpython/rev/80e4cb5888f3
changeset: 105144:80e4cb5888f3
branch: 3.6
parent: 105142:73bd6bbbb5e2
user: Xavier de Gaye <xdegaye at users.sourceforge.net>
date: Wed Nov 16 08:05:27 2016 +0100
summary:
Issue #26935: Fix broken Android dup2() in test_os
files:
Lib/test/test_os.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -56,7 +56,7 @@
try:
import pwd
all_users = [u.pw_uid for u in pwd.getpwall()]
-except ImportError:
+except (ImportError, AttributeError):
all_users = []
try:
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
@@ -1423,7 +1423,12 @@
break
os.closerange(3, 256)
with open({TESTFN!r}, 'rb') as f:
- os.dup2(f.fileno(), fd)
+ new_fd = f.fileno()
+ # Issue #26935: posix allows new_fd and fd to be equal but
+ # some libc implementations have dup2 return an error in this
+ # case.
+ if new_fd != fd:
+ os.dup2(new_fd, fd)
sys.stdout.buffer.write(os.urandom(4))
sys.stdout.buffer.write(os.urandom(4))
""".format(TESTFN=support.TESTFN)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list