Command Promts (>>>) Disappearing in IDLE

Marking error locations is not syntax highlighting. IDLE marks the character indicated in the SyntaxError instance. Because IDLE uses the code module, which uses the codeop module, while the REPL module uses internal C code, the details of messages can be different. Whether the difference is a bug or not is a different question. The details also depend on the exact garbage provided. Some 3.12.2 REPL examples:

>>> 3.12.2
  File "<stdin>", line 1
    3.12.2
        ^^
SyntaxError: invalid syntax
>>> 3.13.0a4
  File "<stdin>", line 1
    3.13.0a4
         ^
SyntaxError: invalid decimal literal
>>> Python 3.13.0a4
  File "<stdin>", line 1
    Python 3.13.0a4
                ^
SyntaxError: invalid decimal literal

For 3.13, IDLE (code.InteractiveInterpeter and codeop._maybe_compile) also marks the 0.

1 Like