python / python/cpython

Five curses documentation statements contradict the implementation

オープン
#157,140 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Doc/library/curses.rst を開き、記載されている5つの記述と repro.py の出力を比較してください。開始する前に、リンクされている PR gh-157141 を確認してください。文書化された5つの動作すべてが、示された実装と一致すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。