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

Skip to content

Commit b3d62ce

Browse files
Issue #17248: Fix os.*chown() testing when user has group root.
1 parent 54db2fd commit b3d62ce

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Lib/test/test_posix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,11 @@ def check_stat(uid, gid):
279279
# non-root cannot chown to root, raises OSError
280280
self.assertRaises(OSError, chown_func, first_param, 0, 0)
281281
check_stat(uid, gid)
282-
self.assertRaises(OSError, chown_func, first_param, -1, 0)
283-
check_stat(uid, gid)
284282
self.assertRaises(OSError, chown_func, first_param, 0, -1)
285283
check_stat(uid, gid)
284+
if gid != 0:
285+
self.assertRaises(OSError, chown_func, first_param, -1, 0)
286+
check_stat(uid, gid)
286287
# test illegal types
287288
for t in str, float:
288289
self.assertRaises(TypeError, chown_func, first_param, t(uid), gid)

0 commit comments

Comments
 (0)