-
-
Notifications
You must be signed in to change notification settings - Fork 206
Open
Labels
compatibilityCompatibility with CPython and the broader ecosystemCompatibility with CPython and the broader ecosystem
Description
Hello,
Writing a history file after a call to readline.set_history_length
results in an unreadable history file. For example, with cpython-3.12.4+20240713-x86_64-unknown-linux-gnu-install_only.tar.gz
:
import readline
import os
readline.add_history("first line")
readline.add_history("second line")
readline.add_history("third line")
readline.set_history_length(2)
readline.write_history_file('historyfile.tmp')
try:
readline.read_history_file('historyfile.tmp')
finally:
os.remove('historyfile.tmp')
gives me a traceback on the read_history_file
:
Traceback (most recent call last):
File "/script.py", line 12, in <module>
readline.read_history_file('historyfile.tmp')
OSError: [Errno 22] Invalid argument
This might be a conflict/incompatibility between editline and a history library that doesn't work with editline's _HiStOrY_V2_
format.
I've added a test to CPython that should fail in this case. I don't know what more I can do on the CPython side.
The same “Invalid argument” error happens when trying to read a history file produced with GNU readline. This can affect users switching from some earlier standalone builds.
Metadata
Metadata
Assignees
Labels
compatibilityCompatibility with CPython and the broader ecosystemCompatibility with CPython and the broader ecosystem