Commit b2499669 authored by Anthony Sottile's avatar Anthony Sottile Committed by INADA Naoki

bpo-19891: Ignore error while writing history file (GH-8483)

parent 336c9458
......@@ -439,7 +439,16 @@ def enablerlcompleter():
readline.read_history_file(history)
except OSError:
pass
atexit.register(readline.write_history_file, history)
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
pass
atexit.register(write_history)
sys.__interactivehook__ = register_readline
......
Ignore errors caused by missing / non-writable homedir while writing history
during exit of an interactive session. Patch by Anthony Sottile.
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