diff options
author | Brad Smith <infinitewarp@users.noreply.github.com> | 2017-10-10 21:52:58 (GMT) |
---|---|---|
committer | Mariatta <Mariatta@users.noreply.github.com> | 2017-10-10 21:52:58 (GMT) |
commit | eeb5ffd54e56dd89a99c74eb512c36d62649cfec (patch) | |
tree | 14bcd3c07e713f6fa873e045f82c27a8bd2ee02e | |
parent | 39ecb9c71b6e55d8a61a710d0144231bd88f9ada (diff) | |
download | cpython-eeb5ffd54e56dd89a99c74eb512c36d62649cfec.zip cpython-eeb5ffd54e56dd89a99c74eb512c36d62649cfec.tar.gz cpython-eeb5ffd54e56dd89a99c74eb512c36d62649cfec.tar.bz2 |
bpo-31537: Update readline documentation example. (GH-3925)
Change the code example from using `get_history_length` to `get_current_history_length`.
-rw-r--r-- | Doc/library/readline.rst | 4 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2017-10-08-23-02-14.bpo-31537.SiFNM8.rst | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst index 54c54b4..837816e 100644 --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -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) diff --git a/Misc/NEWS.d/next/Documentation/2017-10-08-23-02-14.bpo-31537.SiFNM8.rst b/Misc/NEWS.d/next/Documentation/2017-10-08-23-02-14.bpo-31537.SiFNM8.rst new file mode 100644 index 0000000..9244d7e --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2017-10-08-23-02-14.bpo-31537.SiFNM8.rst @@ -0,0 +1,2 @@ +Fix incorrect usage of ``get_history_length`` in readline documentation +example code. Patch by Brad Smith. |