Bug report
Bug description:
Start python with the basic repl and a PYTHONSTARTUP file
export PYTHON_BASIC_REPL=1; echo 'import math' > /tmp/foo.py; export PYTHONSTARTUP="/tmp/foo.py"; python
type 1/0 and the traceback shows
Python 3.13.5 | packaged by Anaconda, Inc. | (main, Jun 12 2025, 16:09:02) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 1/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> import math ^^^ ZeroDivisionError: division by zero >>>
Expected behavior (i.e. export PYTHON_BASIC_REPL=1; unset PYTHONSTARTUP; python):
>>> 1/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> 1/0 ~^~ ZeroDivisionError: division by zero >>>
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- gh-137576: Fix for Basic REPL Showing Incorrect Code in Tracebacks with PYTHONSTARTUP #137625
- [3.14] gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with
PYTHONSTARTUP(GH-137625) #137771 - [3.13] gh-137576: Fix for Basic REPL showing incorrect code in tracebacks with
PYTHONSTARTUP(GH-137625) #137778