[Python-checkins] gh-95376: Add test for names containing null (GH-GH-5394) (GH-95747)

ambv webhook-mailer at python.org
Sat Aug 6 13:32:31 EDT 2022


https://github.com/python/cpython/commit/f05a0f48e82ba5759f2e405de58ce0d0028b0af6
commit: f05a0f48e82ba5759f2e405de58ce0d0028b0af6
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2022-08-06T19:32:27+02:00
summary:

gh-95376: Add test for names containing null (GH-GH-5394) (GH-95747)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland at protonmail.com>
(cherry picked from commit a17cd47b614f8bc660788647a009a25e121221d7)

Co-authored-by: Sion Kang <31057849+Yaminyam at users.noreply.github.com>

files:
M Lib/test/test_pwd.py

diff --git a/Lib/test/test_pwd.py b/Lib/test/test_pwd.py
index f8f12571ca9..d217e059808 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 = {}



More information about the Python-checkins mailing list