]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-95376: Add test for names containing null (GH-GH-5394) (GH-95747)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 6 Aug 2022 17:32:27 +0000 (10:32 -0700)
committerGitHub <noreply@github.com>
Sat, 6 Aug 2022 17:32:27 +0000 (19:32 +0200)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
(cherry picked from commit a17cd47b614f8bc660788647a009a25e121221d7)

Co-authored-by: Sion Kang <31057849+Yaminyam@users.noreply.github.com>
Lib/test/test_pwd.py

index f8f12571ca90e0dea52f8f58163abbf9b7ced7ae..d217e059808fde11582c39aa8c769a7336b9c407 100644 (file)
@@ -59,6 +59,8 @@ class PwdTest(unittest.TestCase):
         self.assertRaises(TypeError, pwd.getpwnam)
         self.assertRaises(TypeError, pwd.getpwnam, 42)
         self.assertRaises(TypeError, pwd.getpwall, 42)
+        # embedded null character
+        self.assertRaisesRegex(ValueError, 'null', pwd.getpwnam, 'a\x00b')
 
         # try to get some errors
         bynames = {}