mirror of
https://github.com/python/cpython.git
synced 2026-01-04 14:32:21 +00:00
bpo-19891: Ignore error while writing history file (GH-8483)
This commit is contained in:
parent
336c945858
commit
b2499669ef
2 changed files with 12 additions and 1 deletions
11
Lib/site.py
11
Lib/site.py
|
|
@ -439,7 +439,16 @@ def register_readline():
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
Ignore errors caused by missing / non-writable homedir while writing history
|
||||
during exit of an interactive session. Patch by Anthony Sottile.
|
||||
Loading…
Add table
Add a link
Reference in a new issue