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

gh-127495: Append to history file after every statement in PyREPL#132294

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 10 commits intopython:mainfromskirpichev:append-repl-history/127495
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
10 commits
Select commitHold shift + click to select a range
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
PrevPrevious commit
address review: save history *after* statement was executed
  • Loading branch information
@skirpichev
skirpichev committedApr 19, 2025
commit646ee8616439b95a08f699252e5092189ac2f77a
6 changes: 3 additions & 3 deletionsLib/_pyrepl/simple_interact.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -142,13 +142,13 @@ def maybe_run_command(statement: str) -> bool:
if maybe_run_command(statement):
continue

input_name = f"<python-input-{input_n}>"
more = console.push(_strip_final_indent(statement), filename=input_name, _symbol="single") # type: ignore[call-arg]
assert not more
try:
append_history_file()
except (FileNotFoundError, PermissionError, OSError) as e:
warnings.warn(f"failed to open the history file for writing: {e}")
input_name = f"<python-input-{input_n}>"
more = console.push(_strip_final_indent(statement), filename=input_name, _symbol="single") # type: ignore[call-arg]
assert not more
input_n += 1
except KeyboardInterrupt:
r = _get_reader()
Expand Down
2 changes: 1 addition & 1 deletionLib/test/test_pyrepl/test_pyrepl.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1360,7 +1360,7 @@ def test_history_survive_crash(self):
history = pathlib.Path(hfile.name).read_text()
self.assertIn("spam", history)
self.assertIn("time", history)
self.assertIn("sleep", history)
self.assertNotIn("sleep", history)
self.assertNotIn("preved", history)

def test_keyboard_interrupt_after_isearch(self):
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
In PyREPL, append a new entry to the ``PYTHON_HISTORY`` file *before* every
statement was executed. This should preserve command-line history after
interpreter isterminated. Patch by Sergey B Kirpichev.
In PyREPL, append a new entry to the ``PYTHON_HISTORY`` file *after* every
statement. This should preserve command-line history after interpreter is
terminated. Patch by Sergey B Kirpichev.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp