https://github.com/python/cpython/commit/c92588efd3676685688b947ed9abe5c0cc9e7b81
commit: c92588efd3676685688b947ed9abe5c0cc9e7b81
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-05-15T16:33:46Z
summary:
gh-149879: Fix test_pwd on Cygwin (#149880)
On Cygwin, pwd.getpwuid(-1) returns an user ('Unknown+User').
files:
M Lib/test/test_pwd.py
diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
index aa090b464a7222..d0ef30ec493084 100644
--- a/Lib/test/test_pwd.py
+++ b/Lib/test/test_pwd.py
@@ -103,9 +103,11 @@ def test_errors(self):
self.assertNotIn(fakeuid, byuids)
self.assertRaises(KeyError, pwd.getpwuid, fakeuid)
- # -1 shouldn't be a valid uid because it has a special meaning in many
- # uid-related functions
- self.assertRaises(KeyError, pwd.getpwuid, -1)
+ # On Cygwin, getpwuid(-1) returns 'Unknown+User' user
+ if sys.platform != 'cygwin':
+ # -1 shouldn't be a valid uid because it has a special meaning in
many
+ # uid-related functions
+ self.assertRaises(KeyError, pwd.getpwuid, -1)
# should be out of uid_t range
self.assertRaises(KeyError, pwd.getpwuid, 2**128)
self.assertRaises(KeyError, pwd.getpwuid, -2**128)
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]