]> granicus.if.org Git - python/commitdiff
Issue #10570: curses.putp() is now expecting a byte string, instead of a
authorVictor Stinner <victor.stinner@haypocalc.com>
Thu, 3 Nov 2011 19:35:40 +0000 (20:35 +0100)
committerVictor Stinner <victor.stinner@haypocalc.com>
Thu, 3 Nov 2011 19:35:40 +0000 (20:35 +0100)
Unicode string.

This is an incompatible change, but putp() is used to emit terminfo commands,
which are bytes strings, not Unicode strings.

Lib/test/test_curses.py
Misc/NEWS
Modules/_cursesmodule.c

index 09807834b47c75c30646556951eef67bee126436..58121477b1d2dace06804542900b15258495f8e6 100644 (file)
@@ -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()
index 993dfaec45cdcb44dbb55558ee5808ca8cd24cc5..276f6659d065bdbbcbe97c400fc705ecbf1d3acb 100644 (file)
--- 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.
 
index 4f7a5258cf57a9d19a2c0cde7d2c4e801c023b29..5e1afa9894a2648b2936e6870b44a113a7890426 100644 (file)
@@ -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");
 }