python / python/cpython

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

Đang mở
#131,248 14 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

3.13 3.14 stdlib topic-repl type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện ba ví dụ bằng Python 3.13 trên Windows, so sánh các prompt có 236 ký tự và hơn 236 ký tự, cùng với ký tự xuống dòng được thêm thủ công. Truy vết việc xử lý prompt nhập liệu của REPL tạo ra văn bản biến mất hoặc bị đặt sai vị trí; hoàn thành có nghĩa là các prompt dài vẫn hiển thị và con trỏ nhập liệu nằm ở cuối prompt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
cli, operating-systems
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.