Preserve the final output when interactive code exits by Boulea7 · Pull Request #1066 · bpython/bpython
Repository navigation
Preserve the final output when interactive code exits - #1066
Open
Boulea7 wants to merge 1 commit into bpython:main from Boulea7:fix/745-preserve-exit-output
Open
Preserve the final output when interactive code exits #1066 Boulea7 wants to merge 1 commit into bpython:main from Boulea7:fix/745-preserve-exit-output
Conversation
Boulea7 commented Dec 3, 2026
Copy link Copy Markdown
Fixes #745
The final repaint after SystemExit replaced the last output row with a second copy of the command. For argparse, the usage line survived and the error explaining the missing argument disappeared.
The exit frame now keeps the command and its completed output in history, then paints any pending output and leaves the cursor after it.
- Verified the original
argparseexample in real PTYs against bpython 0.26, main, and CPython. The error stays visible, the command appears once, and the exit status remains 2. - Added screen regressions for the diagnostic, zero-width output, and pending output longer than a screen. The full suite reported 346 passed, 8 skipped, and 3 expected failures. Ruff and
git diff --checkpassed.
The verification uses the bpython console script. The module launcher currently exits 1 for the same exception. A separate stress case with repeated decomposed Unicode can fail in the live renderer before the exit frame.
Assisted-by: Codex
Preserve the final output when interactive code exits
bab5ac2
codecov
Bot
commented
Dec 3, 2026
·
edited
Loading
Copy link Copy Markdown
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@ ## main #1066 +/- ## ========================================== - Coverage 76.51% 76.23% -0.29% ========================================== Files 62 60 -2 Lines 8308 8618 +310 ========================================== + Hits 6357 6570 +213 - Misses 1951 2048 +97 ☔ View full report in Codecov by Harness .
|