[issue22940] readline does not offer partial saves

bru report at bugs.python.org
Tue Nov 25 15:30:57 CET 2014


New submission from bru:

The "readline" module offers "write_history_file" from readline/history.h "write_history", but there's no "append_history_file" that would invoke "append_history" from the C header.

This causes inconveniences when saving history to a file (like shown there: https://docs.python.org/3.5/library/readline.html?highlight=readline#example). Indeed, say you have 2 interpreters (A) and (B) open.
- (A) and (B) load the history, composed of (z) lines
- you work on both, writing (a) lines in (A) and (b) lines in (b)
- you close (A), the history file now has (z)+(a)
- you close (B), the history file now has (z)+(b)
Therefore (A) history (the (a) lines) is lost. Offering "append_history_file" would be a nice way to fix this problem: having (z)+(a)+(b) in the end would be easy.

This is exactly what the attached patch does. With it are tests, doc and an example. I've not updated Misc/NEWS yet though (no issue #).

----------
components: Library (Lib)
files: 0001-Add-readline.append_history_file-function.patch
keywords: patch
messages: 231661
nosy: bru
priority: normal
severity: normal
status: open
title: readline does not offer partial saves
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37275/0001-Add-readline.append_history_file-function.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22940>
_______________________________________


More information about the Python-bugs-list mailing list