Skip to content

Commit 8cb7011

Browse files
committed
gh-149879: Fix test_tarfile on Cygwin
On Cygwin, there is no root user (uid 0).
1 parent 9ee9f58 commit 8cb7011

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/test/test_tarfile.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3205,7 +3205,11 @@ def root_is_uid_gid_0():
32053205
import pwd, grp
32063206
except ImportError:
32073207
return False
3208-
if pwd.getpwuid(0)[0] != 'root':
3208+
try:
3209+
if pwd.getpwuid(0)[0] != 'root':
3210+
return False
3211+
except KeyError:
3212+
# On Cygwin, there is no root user (uid 0)
32093213
return False
32103214
if grp.getgrgid(0)[0] != 'root':
32113215
return False

0 commit comments

Comments
 (0)