Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents afa94a5 + 2106010 commit 1e2784eCopy full SHA for 1e2784e
1 file changed
Lib/test/test_os.py
@@ -56,7 +56,7 @@
56
try:
57
import pwd
58
all_users = [u.pw_uid for u in pwd.getpwall()]
59
-except ImportError:
+except (ImportError, AttributeError):
60
all_users = []
61
62
from _testcapi import INT_MAX, PY_SSIZE_T_MAX
@@ -1423,7 +1423,12 @@ def test_urandom_fd_reopened(self):
1423
break
1424
os.closerange(3, 256)
1425
with open({TESTFN!r}, 'rb') as f:
1426
- os.dup2(f.fileno(), fd)
+ new_fd = f.fileno()
1427
+ # Issue #26935: posix allows new_fd and fd to be equal but
1428
+ # some libc implementations have dup2 return an error in this
1429
+ # case.
1430
+ if new_fd != fd:
1431
+ os.dup2(new_fd, fd)
1432
sys.stdout.buffer.write(os.urandom(4))
1433
1434
""".format(TESTFN=support.TESTFN)
0 commit comments