summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-07-02 11:02:08 (GMT)
committerGitHub <noreply@github.com>2020-07-02 11:02:08 (GMT)
commit53d2b715d10e5c81cb9c86fd25e88ace4e41bc25 (patch)
tree24927d8bb7b97fdd9fba668818ca58dcdf60031a /Lib
parente73896241e55f452656fd8070eb79f344091bca0 (diff)
downloadcpython-53d2b715d10e5c81cb9c86fd25e88ace4e41bc25.zip
cpython-53d2b715d10e5c81cb9c86fd25e88ace4e41bc25.tar.gz
cpython-53d2b715d10e5c81cb9c86fd25e88ace4e41bc25.tar.bz2
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
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 0ab917e07ed64c6bfde6f6e791f9b28acc97b510) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/site.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/site.py b/Lib/site.py
index a065ab0..9fa21cc 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -444,9 +444,9 @@ def enablerlcompleter():
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)