Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ec8561

Browse files
[3.11] gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (GH-117126) (#117138)
gh-117061: Fix test_posix.test_sched_setaffinity() on RHEL9 (GH-117126) On RHEL9, sched_setaffinity(0, []) does not fail. (cherry picked from commit 50f9b0b) Co-authored-by: Victor Stinner <[email protected]>
1 parent 7323c4d commit 0ec8561

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Lib/test/test_posix.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,21 @@ def test_sched_getaffinity(self):
13271327
def test_sched_setaffinity(self):
13281328
mask = posix.sched_getaffinity(0)
13291329
self.addCleanup(posix.sched_setaffinity, 0, list(mask))
1330+
13301331
if len(mask) > 1:
13311332
# Empty masks are forbidden
13321333
mask.pop()
13331334
posix.sched_setaffinity(0, mask)
13341335
self.assertEqual(posix.sched_getaffinity(0), mask)
1335-
self.assertRaises(OSError, posix.sched_setaffinity, 0, [])
1336+
1337+
try:
1338+
posix.sched_setaffinity(0, [])
1339+
# gh-117061: On RHEL9, sched_setaffinity(0, []) does not fail
1340+
except OSError:
1341+
# sched_setaffinity() manual page documents EINVAL error
1342+
# when the mask is empty.
1343+
pass
1344+
13361345
self.assertRaises(ValueError, posix.sched_setaffinity, 0, [-10])
13371346
self.assertRaises(ValueError, posix.sched_setaffinity, 0, map(int, "0X"))
13381347
self.assertRaises(OverflowError, posix.sched_setaffinity, 0, [1<<128])

0 commit comments

Comments
 (0)