From a17cd47b614f8bc660788647a009a25e121221d7 Mon Sep 17 00:00:00 2001 From: Sion Kang <31057849+Yaminyam@users.noreply.github.com> Date: Sun, 7 Aug 2022 01:53:19 +0900 Subject: [PATCH] gh-95376: Add test for names containing null (#GH-5394) Co-authored-by: Erlend Egeberg Aasland --- Lib/test/test_pwd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py index c789326425be32..aa090b464a7222 100644 --- a/Lib/test/test_pwd.py +++ b/Lib/test/test_pwd.py @@ -59,6 +59,8 @@ def test_errors(self): 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 = {}