python / python/cpython

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

Aperta
#146,046 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stdlib topic-repl type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il confronto nella Windows Python REPL usando sia il terminale integrato nel sistema operativo sia il terminale integrato di VS Code, incluso il ricopiare l’input dalla REPL. Inizia tracciando la gestione dell’input del terminale Windows della REPL e la gestione del copia e incolla. Il lavoro è completato quando uno spazio unificatore rimane distinto da uno spazio normale e il confronto viene valutato consistentemente come false.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
cli, operating-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.