summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-03 20:35:40 +0100
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-03 20:35:40 +0100
commitb588e731715f9e77b206dcbcc5198393f79e61b7 (patch)
tree214179b9220027dd8a2db0bc6ff5431e7038a6f2
parentbfbae77cf77ce4c0404c9549020c49d2fceee367 (diff)
downloadcpython-b588e731715f9e77b206dcbcc5198393f79e61b7.tar.gz
Issue #10570: curses.putp() is now expecting a byte string, instead of a
Unicode string. This is an incompatible change, but putp() is used to emit terminfo commands, which are bytes strings, not Unicode strings.
-rw-r--r--Lib/test/test_curses.py3
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/_cursesmodule.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 09807834b4..58121477b1 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -183,7 +183,7 @@ def module_funcs(stdscr):
win = curses.newwin(5,5)
win = curses.newwin(5,5, 1,1)
curses.nl() ; curses.nl(1)
- curses.putp('abc')
+ curses.putp(b'abc')
curses.qiflush()
curses.raw() ; curses.raw(1)
curses.setsyx(5,5)
@@ -267,6 +267,7 @@ def test_issue6243(stdscr):
def test_issue10570():
b = curses.tparm(curses.tigetstr("cup"), 5, 3)
assert type(b) is bytes
+ curses.putp(b)
def main(stdscr):
curses.savetty()
diff --git a/Misc/NEWS b/Misc/NEWS
index 993dfaec45..276f6659d0 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -66,8 +66,8 @@ Core and Builtins
Library
-------
-- Issue #10570: curses.tigetstr() is now expecting a byte string, instead of
- a Unicode string.
+- Issue #10570: curses.putp() and curses.tigetstr() are now expecting a byte
+ string, instead of a Unicode string.
- Issue #2892: preserve iterparse events in case of SyntaxError.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 4f7a5258cf..5e1afa9894 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2379,7 +2379,8 @@ PyCurses_Putp(PyObject *self, PyObject *args)
{
char *str;
- if (!PyArg_ParseTuple(args,"s;str", &str)) return NULL;
+ if (!PyArg_ParseTuple(args,"y;str", &str))
+ return NULL;
return PyCursesCheckERR(putp(str), "putp");
}