python / python/cpython

Python 3.13: Pressing the Tab key while in the REPL prints 4 spaces instead of 1 tab (breaking backspace)

Open
#125,923 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3.13 topic-repl type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Tested on 3.12:
In the <=3.12 Python REPL on Linux, I can press the tab key, and a tab character is printed in the console. I can then use the backspace key to undo that whole tab character.

Tested on 3.13:
In the 3.13 Python REPL on Linux, if I type a tab character, it seems to convert it to 4 spaces, and thus pressing the backspace key once only deletes 1/4 of the indentation.


This is either a bug, or if it's a feature, it should be configurable and without changing the sane defaults from <=3.12.
How can I get back to the <=3.12 behaviour?

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux, macOS

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Tab and backspace behavior in the Python 3.12 and 3.13 REPL on Linux or macOS, comparing the reported indentation handling. Trace the REPL input path responsible for converting Tab input, then verify that the resolved behavior matches the <=3.12 behavior or provides the requested configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.