Skip to content

gh-159225: PyREPL input should not write to history - #159263

Merged
pablogsal merged 5 commits into
python:mainfrom
edvilme:pyrepl-input-history
Oct 13, 2026
Merged

pablogsal merged 5 commits into
python:mainfrom
edvilme:pyrepl-input-history

Conversation

@edvilme

@edvilme edvilme commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Values entered in an input statement are not Python statements and thus the reader should suspend history recording when in input mode

Fixed with

def suspend_history(self) -> SimpleContextManager:

Values entered in an input statement are not Python statements and thus the reader should suspend history recording when in input mode
@edvilme
edvilme marked this pull request as ready for review October 12, 2026 21:20
@pablogsal pablogsal added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Oct 13, 2026
@pablogsal
pablogsal enabled auto-merge (squash) October 13, 2026 18:11
@pablogsal
pablogsal merged commit 6f92424 into python:main Oct 13, 2026
61 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @edvilme for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@pablogsal

pablogsal commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Thanks a lot for picking this up and working through the history behaviour, @edvilme!

I added a few extra regression cases before merging. Thanks again for the fix and for helping improve the REPL! 🤘

@bedevere-app

bedevere-app Bot commented Oct 13, 2026

Copy link
Copy Markdown

GH-159369 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Oct 13, 2026
@bedevere-app

bedevere-app Bot commented Oct 13, 2026

Copy link
Copy Markdown

GH-159370 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Oct 13, 2026
pablogsal added a commit that referenced this pull request Oct 13, 2026
#159370)

gh-159225: PyREPL input should not write to history (GH-159263)

* gh-159225: PyREPL input should not write to history

Values entered in an input statement are not Python statements and thus the reader should suspend history recording when in input mode

* 📜🤖 Added by blurb_it.

* Remove comment

* Only suspend writing

* gh-159225: Cover input history isolation and interrupted reads

---------
(cherry picked from commit 6f92424)

Co-authored-by: Eduardo Villalpando Mello <eduardovil@microsoft.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
pablogsal added a commit that referenced this pull request Oct 13, 2026
#159369)

gh-159225: PyREPL input should not write to history (GH-159263)

* gh-159225: PyREPL input should not write to history

Values entered in an input statement are not Python statements and thus the reader should suspend history recording when in input mode

* 📜🤖 Added by blurb_it.

* Remove comment

* Only suspend writing

* gh-159225: Cover input history isolation and interrupted reads

---------
(cherry picked from commit 6f92424)

Co-authored-by: Eduardo Villalpando Mello <eduardovil@microsoft.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
@edvilme

edvilme commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks a lot for picking this up and working through the history behaviour, @edvilme!

I added a few extra regression cases before merging. Thanks again for the fix and for helping improve the REPL! 🤘

Muchas gracias! :)
Thanks a lot for reviewing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants