Skip to content

Commit

Permalink
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
Browse files Browse the repository at this point in the history
The write_history() atexit function of the readline completer now
ignores any OSError to ignore error if the filesystem is read-only,
instead of only ignoring FileNotFoundError and PermissionError.
(cherry picked from commit 0ab917e)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
miss-islington and vstinner committed Jul 2, 2020
1 parent e738962 commit 53d2b71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Lib/site.py
Expand Up @@ -444,9 +444,9 @@ def register_readline():
def write_history():
try:
readline.write_history_file(history)
except (FileNotFoundError, PermissionError):
# home directory does not exist or is not writable
# https://bugs.python.org/issue19891
except OSError:
# bpo-19891, bpo-41193: Home directory does not exist
# or is not writable, or the filesystem is read-only.
pass

atexit.register(write_history)
Expand Down
@@ -0,0 +1,4 @@
The ``write_history()`` atexit function of the readline completer now
ignores any :exc:`OSError` to ignore error if the filesystem is read-only,
instead of only ignoring :exc:`FileNotFoundError` and
:exc:`PermissionError`.

0 comments on commit 53d2b71

Please sign in to comment.