python / python/cpython

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

Aperta
#131,248 14 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

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

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

Riproducete i tre esempi con Python 3.13 su Windows, confrontando prompt di 236 e di più di 236 caratteri e la nuova riga aggiunta manualmente. Tracciate la gestione del prompt di input del REPL che produce il testo che scompare o viene posizionato in modo errato; il lavoro è completato quando i prompt lunghi rimangono visibili e il cursore di input si trova alla fine del prompt.

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.