python / python/cpython

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

Offen
#146,046 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

stdlib topic-repl type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Vergleich in der Windows Python REPL sowohl mit dem vom Betriebssystem bereitgestellten Terminal als auch mit dem integrierten VS Code-Terminal, einschließlich des Zurückkopierens der Eingabe aus der REPL. Beginne damit, die Eingabe- sowie die Kopier-/Einfügebehandlung des Windows-Terminals der REPL nachzuverfolgen. Als erledigt gilt, wenn ein geschütztes Leerzeichen von einem normalen Leerzeichen unterscheidbar bleibt und der Vergleich konsistent als false ausgewertet wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
cli, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.