[Python-checkins] cpython (merge 3.2 -> default): (Merge 3.2) Issue #10570: curses.tigetstr() is now expecting a byte string,
victor.stinner
python-checkins at python.org
Wed Nov 2 23:46:33 CET 2011
http://hg.python.org/cpython/rev/ab11a6a73683
changeset: 73312:ab11a6a73683
parent: 73310:5a0839d412b9
parent: 73311:e41663970ca5
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Wed Nov 02 23:47:58 2011 +0100
summary:
(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.
files:
Doc/library/curses.rst | 2 +-
Lib/test/test_curses.py | 7 ++++++-
Misc/NEWS | 3 +++
Modules/_cursesmodule.c | 2 +-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -566,7 +566,7 @@
Instantiate the string *str* with the supplied parameters, where *str* should
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.
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -190,7 +190,7 @@
curses.tigetflag('hc')
curses.tigetnum('co')
curses.tigetstr('cr')
- curses.tparm('cr')
+ curses.tparm(b'cr')
curses.typeahead(sys.__stdin__.fileno())
curses.unctrl('a')
curses.ungetch('a')
@@ -280,6 +280,10 @@
if 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):
curses.savetty()
try:
@@ -289,6 +293,7 @@
test_resize_term(stdscr)
test_issue6243(stdscr)
test_unget_wch(stdscr)
+ test_issue10570()
finally:
curses.resetty()
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -350,6 +350,9 @@
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 #2892: preserve iterparse events in case of SyntaxError.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2642,7 +2642,7 @@
PyCursesSetupTermCalled;
- if (!PyArg_ParseTuple(args, "s|iiiiiiiii:tparm",
+ if (!PyArg_ParseTuple(args, "y|iiiiiiiii:tparm",
&fmt, &i1, &i2, &i3, &i4,
&i5, &i6, &i7, &i8, &i9)) {
return NULL;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list