python / python/cpython

IDLE gets confused when switching between tabs and spaces.

Open
#142,107 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

Bug description:

My IDLE is set to the default 4-space indent. When I switch to using tabs through whatever the keyboard for toggle-tabs, after the popup message, the tab key generates the tab character.

If I switch back to using spaces using the same keyboard shortcut, I find that the tab key generates eight spaces instead of the usual four. I don’t think that’s the intended behaviour.

This is fixed after restarting IDLE.

CPython versions tested on:

3.14

Operating systems tested on:

Windows 11 & 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

Reproduce the issue in IDLE by switching from four-space indentation to tabs with the toggle-tabs keyboard shortcut, then switching back on Python 3.14 under Windows 11 or macOS. Trace the toggle-tabs behavior and verify that the Tab key produces four spaces after returning to spaces without restarting IDLE.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, tooling
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.