aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pyrepl/test_pyrepl.py
diff options
context:
space:
mode:
authordevdanzin <74280297+devdanzin@users.noreply.github.com>2024-10-26 22:23:53 -0300
committerGitHub <noreply@github.com>2024-10-27 01:23:53 +0000
commit44becb8cba677cbfdbcf2f7652277e5e1efc4f20 (patch)
treeaade9bc93fcb4f9e1eb89194f191bae7253ff8ed /Lib/test/test_pyrepl/test_pyrepl.py
parent51b012b2a8093c92ef2c06884f9719657f9b17f7 (diff)
downloadcpython-44becb8cba677cbfdbcf2f7652277e5e1efc4f20.tar.gz
cpython-44becb8cba677cbfdbcf2f7652277e5e1efc4f20.zip
gh-125666: Avoid PyREPL exiting when a null byte is in input (#125732)
Diffstat (limited to 'Lib/test/test_pyrepl/test_pyrepl.py')
-rw-r--r--Lib/test/test_pyrepl/test_pyrepl.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py
index 1a76832386b..f29a7ffbd7c 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -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')