Bug description:
curses.window.border() and curses.window.box() raise TypeError on a build with ncursesw when one argument is a one-character str and another is 0, which both border.__doc__ and Doc/library/curses.rst document as the request for that parameter's default character:
import curses
def main(stdscr):
win = curses.newwin(5, 10, 0, 0)
win.border('|', '|', '-', '-') # default corners: works
win.border('|', '|', '-', '-', 0, 0, 0, 0) # documented as the same thing
curses.wrapper(main)
win.border('|', '|', '-', '-', 0, 0, 0, 0) # documented as the same thing
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: border() cannot mix integer or bytes characters with wide string characters
On 3.14.4 the same script exits 0. win.box('|', 0) and win.box(0, '-') fail the same way.
The restriction on mixing characters is intended (gh-151757), but the documented 0 sentinel now counts as an integer character.
Expected: 0 keeps meaning "use the default" on this path, or Doc/library/curses.rst records that 0 cannot appear in a call that also passes a str.
Introduced by GH-151758.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug description:
curses.window.border()andcurses.window.box()raiseTypeErroron a build withncurseswwhen one argument is a one-characterstrand another is0, which bothborder.__doc__andDoc/library/curses.rstdocument as the request for that parameter's default character:On 3.14.4 the same script exits 0.
win.box('|', 0)andwin.box(0, '-')fail the same way.The restriction on mixing characters is intended (gh-151757), but the documented
0sentinel now counts as an integer character.Expected:
0keeps meaning "use the default" on this path, orDoc/library/curses.rstrecords that0cannot appear in a call that also passes astr.Introduced by GH-151758.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs