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

[3.14] gh-128066: Properly handle history file writes for RO fs on PyREPL (gh-134380)#134385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ambv merged 1 commit intopython:3.14frommiss-islington:backport-c91ad5d-3.14
May 20, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletionsLib/_pyrepl/simple_interact.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,7 @@
importsys
importcode
importwarnings
importerrno

from .readlineimport_get_reader,multiline_input,append_history_file

Expand DownExpand Up@@ -153,6 +154,7 @@ def maybe_run_command(statement: str) -> bool:
append_history_file()
except (FileNotFoundError,PermissionError,OSError)ase:
warnings.warn(f"failed to open the history file for writing:{e}")

input_n+=1
exceptKeyboardInterrupt:
r=_get_reader()
Expand Down
8 changes: 7 additions & 1 deletionLib/site.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,6 +75,7 @@
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]
Expand DownExpand Up@@ -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)

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
Fixes an edge case where PyREPL improperly threw an error when Python is
invoked on a read only filesystem while trying to write history file
entries.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp