mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
(Merge 3.2) Issue #10570: curses.tigetstr() is now expecting a byte string,
instead of a Unicode string. This is an incompatible change, but the previous behaviour was completly wrong.
This commit is contained in:
commit
df5bccc8a3
4 changed files with 11 additions and 3 deletions
|
@ -566,7 +566,7 @@ The module :mod:`curses` defines the following functions:
|
||||||
|
|
||||||
Instantiate the string *str* with the supplied parameters, where *str* should
|
Instantiate the string *str* with the supplied parameters, where *str* should
|
||||||
be a parameterized string obtained from the terminfo database. E.g.
|
be a parameterized string obtained from the terminfo database. E.g.
|
||||||
``tparm(tigetstr("cup"), 5, 3)`` could result in ``'\033[6;4H'``, the exact
|
``tparm(tigetstr("cup"), 5, 3)`` could result in ``b'\033[6;4H'``, the exact
|
||||||
result depending on terminal type.
|
result depending on terminal type.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ def module_funcs(stdscr):
|
||||||
curses.tigetflag('hc')
|
curses.tigetflag('hc')
|
||||||
curses.tigetnum('co')
|
curses.tigetnum('co')
|
||||||
curses.tigetstr('cr')
|
curses.tigetstr('cr')
|
||||||
curses.tparm('cr')
|
curses.tparm(b'cr')
|
||||||
curses.typeahead(sys.__stdin__.fileno())
|
curses.typeahead(sys.__stdin__.fileno())
|
||||||
curses.unctrl('a')
|
curses.unctrl('a')
|
||||||
curses.ungetch('a')
|
curses.ungetch('a')
|
||||||
|
@ -280,6 +280,10 @@ def test_unget_wch(stdscr):
|
||||||
if read != ch:
|
if read != ch:
|
||||||
raise AssertionError("%r != %r" % (read, ch))
|
raise AssertionError("%r != %r" % (read, ch))
|
||||||
|
|
||||||
|
def test_issue10570():
|
||||||
|
b = curses.tparm(curses.tigetstr("cup"), 5, 3)
|
||||||
|
assert type(b) is bytes
|
||||||
|
|
||||||
def main(stdscr):
|
def main(stdscr):
|
||||||
curses.savetty()
|
curses.savetty()
|
||||||
try:
|
try:
|
||||||
|
@ -289,6 +293,7 @@ def main(stdscr):
|
||||||
test_resize_term(stdscr)
|
test_resize_term(stdscr)
|
||||||
test_issue6243(stdscr)
|
test_issue6243(stdscr)
|
||||||
test_unget_wch(stdscr)
|
test_unget_wch(stdscr)
|
||||||
|
test_issue10570()
|
||||||
finally:
|
finally:
|
||||||
curses.resetty()
|
curses.resetty()
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #10570: curses.tigetstr() is now expecting a byte string, instead of
|
||||||
|
a Unicode string.
|
||||||
|
|
||||||
- Issue #13295: http.server now produces valid HTML 4.01 strict.
|
- Issue #13295: http.server now produces valid HTML 4.01 strict.
|
||||||
|
|
||||||
- Issue #2892: preserve iterparse events in case of SyntaxError.
|
- Issue #2892: preserve iterparse events in case of SyntaxError.
|
||||||
|
|
|
@ -2642,7 +2642,7 @@ PyCurses_tparm(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
PyCursesSetupTermCalled;
|
PyCursesSetupTermCalled;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "s|iiiiiiiii:tparm",
|
if (!PyArg_ParseTuple(args, "y|iiiiiiiii:tparm",
|
||||||
&fmt, &i1, &i2, &i3, &i4,
|
&fmt, &i1, &i2, &i3, &i4,
|
||||||
&i5, &i6, &i7, &i8, &i9)) {
|
&i5, &i6, &i7, &i8, &i9)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue