Five curses documentation statements contradict the implementation
Aperta
Nessuno ha ancora preso questa issue.
docs
topic-curses
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Apri Doc/library/curses.rst e confronta le cinque affermazioni elencate con gli output di repro.py. Controlla il PR gh-157141 collegato prima di iniziare; il lavoro è completato quando tutti e cinque i comportamenti documentati corrispondono all'implementazione dimostrata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 25/100