python / python/cpython

REPL: unexpected behavior with   (non break space) on Windows

Open
#146,046 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

Bug description:

Copy " "==" " into Python REPL (the first space is non breakable, you need to generate a new one though), there are two problems I found:

  1. In OS built-in terminal, it is always true
Python 3.13.12 (tags/v3.13.12:1cbe481, Feb  3 2026, 18:22:25) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> " "==" "
True
>>> " "==" " # copied
True
  1. In Vscode integrated terminal, it was false as expected at first. But if you copied from the REPL then, the non break space somehow has changed to normal space, this is the same behavior with the built-in terminal.
Python 3.13.12 (tags/v3.13.12:1cbe481, Feb  3 2026, 18:22:25) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Ctrl click to launch VS Code Native REPL
>>> " "==" "  
False
>>> " "==" " # copied
True

On Linux at least Ubuntu, it behave correctly as expected.

Python 3.12.3 (main, Mar  3 2026, 12:15:18) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> " "==" "
False
>>> " "==" " # copied
False

Based on testing multiple versions, it appears that​ version is not a factor.

CPython versions tested on:

3.13

Operating systems tested on:

Windows

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 comparison in the Windows Python REPL using both the OS-built-in terminal and the VS Code integrated terminal, including copying the input back from the REPL. Start by tracing the REPL's Windows terminal input and copy/paste handling. Done means a non-breaking space remains distinct from a normal space and the comparison consistently evaluates as false.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.