Commit eeb5ffd5 authored by Brad Smith's avatar Brad Smith Committed by Mariatta

bpo-31537: Update readline documentation example. (GH-3925)

Change the code example from using `get_history_length` to `get_current_history_length`.
parent 39ecb9c7
......@@ -312,13 +312,13 @@ sessions, by only appending the new history. ::
try:
readline.read_history_file(histfile)
h_len = readline.get_history_length()
h_len = readline.get_current_history_length()
except FileNotFoundError:
open(histfile, 'wb').close()
h_len = 0
def save(prev_h_len, histfile):
new_h_len = readline.get_history_length()
new_h_len = readline.get_current_history_length()
readline.set_history_length(1000)
readline.append_history_file(new_h_len - prev_h_len, histfile)
atexit.register(save, h_len, histfile)
......
Fix incorrect usage of ``get_history_length`` in readline documentation
example code. Patch by Brad Smith.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment