python / python/cpython

input() not including built-in newline if string > 236 characters

Offen
#131,248 14 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

3.13 3.14 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:

When using input() in the REPL, the behavior is not as expected if the string is > 236 characters (in fact, the input text disappears entirely).


#=====
# string = 236 characters

s = """wow this is a really long sentence, like really who types a sentence this long, but i guess if you have something to say that's important and it takes a long time to say, you can write a long sentence for it, especially if shorter works"""

input(s)  # expected behavior - this shows the text to the user during input

#=====
# string > 236 characters

s = """wow this is a really long sentence, like really who types a sentence this long, but i guess if you have something to say that's important and it takes a long time to say, you can write a long sentence for it, especially if shorter works and you need more text"""

input(s)  # unexpected behavior - this does not show the text to the user during input

#=====
# string > 236 characters, with manual newline added

s = """wow this is a really long sentence, like really who types a sentence this long, but i guess if you have something to say that's important and it takes a long time to say, you can write a long sentence for it, especially if shorter works and you need more text\n"""

input(s)  # unexpected behavior - this shows the text to the user, but the prompt is not at the end of the string

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

Reproduzieren Sie die drei Beispiele mit Python 3.13 unter Windows und vergleichen Sie Prompts mit 236 und mehr als 236 Zeichen sowie den manuell hinzugefügten Zeilenumbruch. Verfolgen Sie die Verarbeitung der REPL-Eingabeaufforderung, die den verschwindenden oder falsch platzierten Text verursacht; abgeschlossen ist die Aufgabe, wenn lange Prompts sichtbar bleiben und sich der Eingabecursor am Ende des Prompts befindet.

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
48/100

Neue Issues direkt in Ihr Postfach

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