#1074078 python3-doc: curses.wrapper() - unclear about return value and other details

#1074078#5
Date:
2024-06-22 22:42:35 UTC
From:
To:
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

#1074078#10
Date:
2024-06-23 13:19:22 UTC
From:
To:
[not speaking for the maintainer]

If you want to see this fixed sooner than later, I'd suggest filing
this report upstream.

#1074078#15
Date:
2024-06-23 16:30:20 UTC
From:
To:
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
docs@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.