8000 gh-122431: Disallow negative values in `readline.append_history_file` by ZeroIntensity · Pull Request #122469 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-122431: Disallow negative values in readline.append_history_file #122469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test to disallow negatives.
  • Loading branch information
ZeroIntensity committed Jul 30, 2024
commit 4d6238035b04c5eecd92146d035042a78a19abf1
8 changes: 8 additions & 0 deletions Lib/test/test_readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ def test_write_read_append(self):
# 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 minumum 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:
Expand Down
Loading
0