Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit379805d

Browse files
miss-islingtonfeohambv
authored
[3.14]gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380) (gh-134385)
(cherry picked from commitc91ad5d)Co-authored-by: Chris Patti <feoh@feoh.org>Co-authored-by: Łukasz Langa <lukasz@langa.pl>
1 parent899ce7d commit379805d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

‎Lib/_pyrepl/simple_interact.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
importsys
3232
importcode
3333
importwarnings
34+
importerrno
3435

3536
from .readlineimport_get_reader,multiline_input,append_history_file
3637

@@ -153,6 +154,7 @@ def maybe_run_command(statement: str) -> bool:
153154
append_history_file()
154155
except (FileNotFoundError,PermissionError,OSError)ase:
155156
warnings.warn(f"failed to open the history file for writing:{e}")
157+
156158
input_n+=1
157159
exceptKeyboardInterrupt:
158160
r=_get_reader()

‎Lib/site.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import_sitebuiltins
7676
import_ioasio
7777
importstat
78+
importerrno
7879

7980
# Prefixes for site-packages; add additional prefixes like /usr/local here
8081
PREFIXES= [sys.prefix,sys.exec_prefix]
@@ -578,10 +579,15 @@ def register_readline():
578579
defwrite_history():
579580
try:
580581
readline_module.write_history_file(history)
581-
except(FileNotFoundError,PermissionError):
582+
exceptFileNotFoundError,PermissionError:
582583
# home directory does not exist or is not writable
583584
# https://bugs.python.org/issue19891
584585
pass
586+
exceptOSError:
587+
iferrno.EROFS:
588+
pass# gh-128066: read-only file system
589+
else:
590+
raise
585591

586592
atexit.register(write_history)
587593

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixes an edge case where PyREPL improperly threw an error when Python is
2+
invoked on a read only filesystem while trying to write history file
3+
entries.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp