Five curses documentation statements contradict the implementation
未关闭
还没有人认领这个 Issue。
docs
topic-curses
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Documentation
Five statements in Doc/library/curses.rst describe behaviour the module does not have.
| documented | says | actually |
|---|---|---|
halfdelay() |
"raise an exception if nothing has been typed" | getch() returns -1 |
termname() |
"truncated to 14 characters" | returns the full name |
window.scroll() |
"no effect unless it has been enabled ... with scrollok" |
raises curses.error |
window.insnstr() |
"If n is zero or negative, the entire string is inserted" | zero inserts nothing |
window.insch() |
"The cursor position does not change" | the (y, x) form moves it |
$ TERM=screen.xterm-256color ./python repro.py; cat out.txt
halfdelay(2); getch() -> -1
termname() -> b'screen.xterm-256color'
scroll() no scrollok -> curses.error: wscrl() (called by scroll()) returned ERR
insnstr('ABC', 0) -> '....'
insch(3, 5, ch); getyx -> (3, 5)
repro.py
import curses
out = []
stdscr = curses.initscr()
try:
curses.cbreak()
curses.halfdelay(2)
out.append(f"halfdelay(2); getch() -> {stdscr.getch()!r}")
curses.cbreak()
out.append(f"termname() -> {curses.termname()!r}")
w = curses.newwin(5, 20, 0, 0)
w.scrollok(False)
try:
w.scroll(1)
out.append("scroll() no scrollok -> returned None")
except curses.error as e:
out.append(f"scroll() no scrollok -> curses.error: {e}")
w.addstr(2, 0, "....")
w.move(2, 0)
w.insnstr("ABC", 0)
out.append(f"insnstr('ABC', 0) -> {w.instr(2, 0, 4).decode()!r}")
w.insch(3, 5, ord('x'))
out.append(f"insch(3, 5, ch); getyx -> {w.getyx()}")
finally:
curses.endwin()
open("out.txt", "w").write("\n".join(out) + "\n")
Linked PRs
- gh-157141
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
打开 Doc/library/curses.rst,将列出的五条陈述与 repro.py 的输出进行比较。在开始之前检查已链接的 PR gh-157141;当所有五项已记录的行为都与所展示的实现相符时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 1/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100