summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_readline.py
diff options
context:
space:
mode:
authorPeter Bierma <zintensitydev@gmail.com>2024-12-05 16:07:38 (GMT)
committerGitHub <noreply@github.com>2024-12-05 16:07:38 (GMT)
commit208b0fb645c0e14b0826c0014e74a0b70c58c9d6 (patch)
tree2e4f8541c8de96054a8fad7443f8b3e867fac63c /Lib/test/test_readline.py
parent67b9a5331ae45aa126877d7f96a1e235600f9c4b (diff)
downloadcpython-208b0fb645c0e14b0826c0014e74a0b70c58c9d6.zip
cpython-208b0fb645c0e14b0826c0014e74a0b70c58c9d6.tar.gz
cpython-208b0fb645c0e14b0826c0014e74a0b70c58c9d6.tar.bz2
gh-122431: Disallow negative values in `readline.append_history_file` (#122469)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test/test_readline.py')
-rw-r--r--Lib/test/test_readline.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py
index 50e77cb..8b8772c 100644
--- a/Lib/test/test_readline.py
+++ b/Lib/test/test_readline.py
@@ -114,6 +114,14 @@ class TestHistoryManipulation (unittest.TestCase):
# write_history_file can create the target
readline.write_history_file(hfilename)
+ # Negative values should be disallowed
+ with self.assertRaises(ValueError):
+ readline.append_history_file(-42, hfilename)
+
+ # See gh-122431, using the minimum signed integer value caused a segfault
+ with self.assertRaises(ValueError):
+ readline.append_history_file(-2147483648, hfilename)
+
def test_nonascii_history(self):
readline.clear_history()
try: