From: Sion Kang <31057849+Yaminyam@users.noreply.github.com> Date: Sat, 6 Aug 2022 16:53:19 +0000 (+0900) Subject: gh-95376: Add test for names containing null (#GH-5394) X-Git-Tag: v3.12.0a1~707 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a17cd47b614f8bc660788647a009a25e121221d7;p=thirdparty%2FPython%2Fcpython.git gh-95376: Add test for names containing null (#GH-5394) Co-authored-by: Erlend Egeberg Aasland --- diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index c789326425be..aa090b464a72 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -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 = {}