Skip to content

[3.9] bpo-41193: Ignore OSError in readline write_history() (GH-21279) #21280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,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
Original file line number Diff line number Diff line change
@@ -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`.