diff options
author | 2018-08-06 02:15:42 -0700 | |
---|---|---|
committer | 2018-08-06 02:15:42 -0700 | |
commit | e20d31cdb33bdfee68bce059f9a9c7ce71b035fe (patch) | |
tree | 17324896c31757551671b065c8c0bd871bd58a02 /Lib | |
parent | bpo-34336: Don't promote possibility to leave out typing.Optional (GH-8677) (diff) | |
download | cpython-e20d31cdb33bdfee68bce059f9a9c7ce71b035fe.tar.gz cpython-e20d31cdb33bdfee68bce059f9a9c7ce71b035fe.tar.bz2 cpython-e20d31cdb33bdfee68bce059f9a9c7ce71b035fe.zip |
bpo-19891: Ignore error while writing history file (GH-8483)
(cherry picked from commit b2499669ef2e6dc9a2cdb49b4dc498e078167e26)
Co-authored-by: Anthony Sottile <asottile@umich.edu>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/site.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py index 1bd63ccf6a2..86ca2dba61b 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -418,7 +418,16 @@ def enablerlcompleter(): readline.read_history_file(history) except IOError: 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 |