Discussion:
Bug#1074078: python3-doc: curses.wrapper() - unclear about return value and other details
(too old to reply)
Michael Gold
2024-06-22 22:50:01 UTC
Permalink
Package: python3-doc
Version: 3.11.8-1
Severity: minor

Dear Maintainer,

The documentation for curses.wrapper says:
Initialize curses and call another callable object, func, which
should be the rest of your curses-using application. If the
application raises an exception, this function will restore the
terminal to a sane state before re-raising the exception and
generating a traceback. The callable object func is then passed the
main window ‘stdscr’ as its first argument, followed by any other
arguments passed to wrapper(). Before calling func, wrapper() turns
on cbreak mode, turns off echo, enables the terminal keypad, and
initializes colors if the terminal has color support. On exit
(whether normally or by exception) it restores cooked mode, turns on
echo, and disables the terminal keypad.

I see several minor problems with this.
1) It doesn't say anything about what's returned on success. The code
has the line 'return func(
)', as expected of a wrapper, which is to
say that it will return whatever the wrapped function returns.
2) There's no code to "generat[e] a traceback". I guess the assumption
is that the re-raised assumption will not be caught, and Python will
do that; but using curses.wrapper that way is merely a suggestion
("func[
] should be the rest"
).
3) It says "re-raising the exception and generating a traceback. The
callable object func is then passed the main window". Despite saying
"then", this is not a linear sequence of events that can happen.
4) "On exit" is unclear about whether it's talking about function exit
or program exit.

- Michael


-- System Information:
Debian Release: trixie/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.8.12-amd64 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-doc depends on:
ii python3.11-doc 3.11.9-1

python3-doc recommends no packages.

Versions of packages python3-doc suggests:
ii python3 3.11.8-1
pn python3-examples <none>

-- no debconf information
Chris Hofstaedtler
2024-06-23 13:30:01 UTC
Permalink
Post by Michael Gold
Dear Maintainer,
[not speaking for the maintainer]
Post by Michael Gold
[..]
If you want to see this fixed sooner than later, I'd suggest filing
this report upstream.
Michael Gold
2024-06-23 16:40:02 UTC
Permalink
Post by Chris Hofstaedtler
If you want to see this fixed sooner than later, I'd suggest filing
this report upstream.
Thanks, but there doesn't seem to be any way to do this without signing
up for a Github account. The Python documentation mentions e-mailing
***@python.org as an alternate method, but that doesn't get "filed" in
the same sense, and I didn't get a response when I tried it in February.

-- Michael

Loading...