Skip to content

Commit eeb5ffd

Browse files
infinitewarpMariatta
authored andcommitted
bpo-31537: Update readline documentation example. (GH-3925)
Change the code example from using `get_history_length` to `get_current_history_length`.
1 parent 39ecb9c commit eeb5ffd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Doc/library/readline.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,13 @@ sessions, by only appending the new history. ::
312312

313313
try:
314314
readline.read_history_file(histfile)
315-
h_len = readline.get_history_length()
315+
h_len = readline.get_current_history_length()
316316
except FileNotFoundError:
317317
open(histfile, 'wb').close()
318318
h_len = 0
319319

320320
def save(prev_h_len, histfile):
321-
new_h_len = readline.get_history_length()
321+
new_h_len = readline.get_current_history_length()
322322
readline.set_history_length(1000)
323323
readline.append_history_file(new_h_len - prev_h_len, histfile)
324324
atexit.register(save, h_len, histfile)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix incorrect usage of ``get_history_length`` in readline documentation
2+
example code. Patch by Brad Smith.

0 commit comments

Comments
 (0)