python / python/cpython

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

未关闭
#131,248 14 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

3.13 3.14 stdlib topic-repl type-bug
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

在 Windows 上使用 Python 3.13 重现这三个示例,比较长度为 236 个字符和超过 236 个字符的提示符,以及手动添加的换行符。跟踪导致文本消失或位置错误的 REPL 输入提示符处理流程;完成的标准是长提示符仍保持可见,并且输入光标位于提示符末尾。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
cli, operating-systems
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。