You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Windows] Python 3.13 New REPL prompt swallows characters with print(..., end=" ") #128067
When I use print and pass an argument to the end-parameter, the resulting line is missing 4 characters.
The four chars of the REPL prompt >>> appear to write over the line, as the cursor blinks on the first visible position (indicator sits under the number 4)
It's possible to capture output in a StringIO in code.InteractiveInterpreter.runcode and add a \n character if the output doesn't end in a newline. It should change the behavior to (in both Windows and Linux):
The proposed fix changes two behaviors that could be considered bugs in how output is handled.
Without the change, in Windows, printing a very long line ending with a space would result in its last wrapped line being overwritten by the prompt and further input:
Activity
devdanzin commentedon Dec 23, 2024
Confirmed on main:
It's possible to see the
10output appear then be overwritten by the prompt. Any string ending without a newline seems to suffer from this:devdanzin commentedon Dec 24, 2024
It's possible to capture output in a
StringIOincode.InteractiveInterpreter.runcodeand add a\ncharacter if the output doesn't end in a newline. It should change the behavior to (in both Windows and Linux):That is, the prompt would always appear on a new line.
If this is considered a good solution, I can submit a PR.
Edit: with a PoC change, the issue is resolved and
test_pyrepl,test_replandtest_codepass.devdanzin commentedon Dec 24, 2024
The proposed fix changes two behaviors that could be considered bugs in how output is handled.
Without the change, in Windows, printing a very long line ending with a space would result in its last wrapped line being overwritten by the prompt and further input:
While on Linux, without the change, the prompt appears right at the end of the long line:
With the change, the prompt always appears on a new line.
JanEricNitschke commentedon Sep 9, 2025
@devdanzin Are you still having a look at this or can i try to give it a go?
23 remaining items
gh-128067: Fix pyrepl overriding printed output without newlines (#13…
pythongh-128067: Fix pyrepl overriding printed output without newlines (
pythongh-128067: Fix pyrepl overriding printed output without newlines (
pythongh-128067: In test_pyrepl, discover escape sequences from termi…
gh-128067: In test_pyrepl, discover escape sequences from terminfo in…
pythongh-128067: In test_pyrepl, discover escape sequences from termi…
pythongh-128067: In test_pyrepl, discover escape sequences from termi…
[3.14] gh-128067: Fix pyrepl overriding printed output without newlin…
[3.13] gh-128067: Fix pyrepl overriding printed output without newlin…
ambv commentedon Jan 2, 2026
Fixed! Thanks for your contribution.
amirihekmatallah-code commentedon Jan 28, 2026
amirihekmatallah-code commentedon Jan 28, 2026
pythongh-128067: Fix pyrepl overriding printed output without newlines (
pythongh-128067: In test_pyrepl, discover escape sequences from termi…