[3.14] gh-138804: Check type in shlex.quote (GH-138809) (#138846)

Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
This commit is contained in:
Miss Islington (bot) 2025-09-13 20:29:50 +02:00 committed by GitHub
parent fbfbfdf33c
commit 18dfc1d6c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View file

@ -330,6 +330,7 @@ def testQuote(self):
unsafe = '"`$\\!' + unicode_sample
self.assertEqual(shlex.quote(''), "''")
self.assertEqual(shlex.quote(None), "''")
self.assertEqual(shlex.quote(safeunquoted), safeunquoted)
self.assertEqual(shlex.quote('test file name'), "'test file name'")
for u in unsafe:
@ -338,6 +339,8 @@ def testQuote(self):
for u in unsafe:
self.assertEqual(shlex.quote("test%s'name'" % u),
"'test%s'\"'\"'name'\"'\"''" % u)
self.assertRaises(TypeError, shlex.quote, 42)
self.assertRaises(TypeError, shlex.quote, b"abc")
def testJoin(self):
for split_command, command in [