diff options
Diffstat (limited to 'Lib/site.py')
-rw-r--r-- | Lib/site.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/site.py b/Lib/site.py index 5c38b1b17d5..f9327197159 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -75,6 +75,7 @@ import builtins import _sitebuiltins import _io as io import stat +import errno # Prefixes for site-packages; add additional prefixes like /usr/local here PREFIXES = [sys.prefix, sys.exec_prefix] @@ -578,10 +579,15 @@ def register_readline(): def write_history(): try: readline_module.write_history_file(history) - except (FileNotFoundError, PermissionError): + except FileNotFoundError, PermissionError: # home directory does not exist or is not writable # https://bugs.python.org/issue19891 pass + except OSError: + if errno.EROFS: + pass # gh-128066: read-only file system + else: + raise atexit.register(write_history) |