gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with PYTHONSTARTUP (#137625)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
adam j hartz 2025-08-14 13:58:11 -04:00 committed by GitHub
parent 8b8bd3d4ad
commit 04f8ef663b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 90 additions and 3 deletions

View file

@ -541,7 +541,7 @@ class StackSummary(list):
colorize = kwargs.get("colorize", False)
row = []
filename = frame_summary.filename
if frame_summary.filename.startswith("<stdin>-"):
if frame_summary.filename.startswith("<stdin-") and frame_summary.filename.endswith('>'):
filename = "<stdin>"
if colorize:
theme = _colorize.get_theme(force_color=True).traceback