python: fix pdb history

This commit is contained in:
J. Fernando Sánchez
2026-06-10 23:06:27 +02:00
parent 1035c858fc
commit dc4b4968bc
3 changed files with 20 additions and 21 deletions

17
python/.pdb_startup.py Normal file
View File

@@ -0,0 +1,17 @@
import atexit
import os
try:
import readline
historyPath = os.path.expanduser("~/.pdb_history")
readline.clear_history()
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
atexit.register(save_history)
except ImportError:
pass