gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732)

This commit is contained in:
devdanzin 2024-10-26 22:23:53 -03:00 committed by GitHub
parent 51b012b2a8
commit 44becb8cba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 1 deletions

View file

@ -1313,6 +1313,11 @@ class TestMain(ReplTestCase):
self.assertIn("in x3", output)
self.assertIn("in <module>", output)
def test_null_byte(self):
output, exit_code = self.run_repl("\x00\nexit()\n")
self.assertEqual(exit_code, 0)
self.assertNotIn("TypeError", output)
def test_readline_history_file(self):
# skip, if readline module is not available
readline = import_module('readline')