[3.13] gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380) (gh-134386)

(cherry picked from commit c91ad5da9d)

Co-authored-by: Chris Patti <feoh@feoh.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
Łukasz Langa 2025-05-20 22:15:43 +02:00 committed by GitHub
parent 7df6749219
commit b41e7b1e02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -75,6 +75,7 @@ import builtins
import _sitebuiltins
import io
import stat
import errno
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
@ -576,6 +577,11 @@ def register_readline():
# 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)