[Python-checkins] cpython (3.2): Issue #10570: curses.putp() is now expecting a byte string, instead of a

victor.stinner python-checkins at python.org
Thu Nov 3 20:35:30 CET 2011


http://hg.python.org/cpython/rev/38f4a251608f
changeset:   73331:38f4a251608f
branch:      3.2
parent:      73329:3e4c0caf56a8
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Thu Nov 03 20:35:40 2011 +0100
summary:
  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.

files:
  Lib/test/test_curses.py |  3 ++-
  Misc/NEWS               |  4 ++--
  Modules/_cursesmodule.c |  3 ++-
  3 files changed, 6 insertions(+), 4 deletions(-)


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
@@ -183,7 +183,7 @@
     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_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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -66,8 +66,8 @@
 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
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2379,7 +2379,8 @@
 {
     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");
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list