Bug description
Python 3.15.0rc3's new PyREPL corrupts the input line when accepting an attribute completion in WSL under Windows Terminal.
The completion candidates themselves are correct, but the resulting input text is corrupted.
Reproducer
>>> a = "Bug"
>>> a.swapcase()
'bUG'
>>> a.s<TAB><TAB>
a.split a.splitlines a.startswith a.strip a.swapcase
>>> a.sapcase()
'bUG'
The completion list correctly contains a.swapcase, but accepting the completion produces a.sapcase().
Environment
- Python: 3.15.0rc3
- Build: main, Oct 3 2026, 01:07:55
- Compiler: Clang 22.1.3
- OS: Linux under WSL
- Terminal: Windows Terminal
- TERM=xterm-256color
- TERM_PROGRAM is unset
Isolation tests
The problem is specific to PyREPL:
python3.15
→ broken
PYTHON_BASIC_COMPLETER=1 python3.15
→ broken
PYTHON_COLORS=0 python3.15
→ broken
PYTHON_BASIC_REPL=1 python3.15
→ works correctly
Therefore changing the completer or disabling colors does not resolve the problem. Disabling PyREPL entirely does.
Expected behavior
After selecting a.swapcase from the completion list, the input should be:
Actual behavior
The input line is corrupted, for example:
The resulting expression nevertheless executes the swapcase() method, suggesting that the completion/input state and the displayed/reconstructed input line may be getting out of sync.
Additional information
This is reproducible with the standard Python 3.15.0rc3 REPL and does not require third-party Python packages.
Linked PRs
Bug description
Python 3.15.0rc3's new PyREPL corrupts the input line when accepting an attribute completion in WSL under Windows Terminal.
The completion candidates themselves are correct, but the resulting input text is corrupted.
Reproducer
The completion list correctly contains a.swapcase, but accepting the completion produces a.sapcase().
Environment
Isolation tests
The problem is specific to PyREPL:
python3.15 → broken PYTHON_BASIC_COMPLETER=1 python3.15 → broken PYTHON_COLORS=0 python3.15 → broken PYTHON_BASIC_REPL=1 python3.15 → works correctlyTherefore changing the completer or disabling colors does not resolve the problem. Disabling PyREPL entirely does.
Expected behavior
After selecting a.swapcase from the completion list, the input should be:
Actual behavior
The input line is corrupted, for example:
The resulting expression nevertheless executes the swapcase() method, suggesting that the completion/input state and the displayed/reconstructed input line may be getting out of sync.
Additional information
This is reproducible with the standard Python 3.15.0rc3 REPL and does not require third-party Python packages.
Linked PRs