Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3bc7e7

Browse files
author
Victor Stinner
committed
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.
1 parent 9c2f42f commit b3bc7e7

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

Lib/test/test_curses.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def module_funcs(stdscr):
183183
win = curses.newwin(5,5)
184184
win = curses.newwin(5,5, 1,1)
185185
curses.nl() ; curses.nl(1)
186-
curses.putp('abc')
186+
curses.putp(b'abc')
187187
curses.qiflush()
188188
curses.raw() ; curses.raw(1)
189189
curses.setsyx(5,5)
@@ -267,6 +267,7 @@ def test_issue6243(stdscr):
267267
def test_issue10570():
268268
b = curses.tparm(curses.tigetstr("cup"), 5, 3)
269269
assert type(b) is bytes
270+
curses.putp(b)
270271

271272
def main(stdscr):
272273
curses.savetty()

Misc/NEWS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ Core and Builtins
6666
Library
6767
-------
6868

69-
- Issue #10570: curses.tigetstr() is now expecting a byte string, instead of
70-
a Unicode string.
69+
- Issue #10570: curses.putp() and curses.tigetstr() are now expecting a byte
70+
string, instead of a Unicode string.
7171

7272
- Issue #2892: preserve iterparse events in case of SyntaxError.
7373

Modules/_cursesmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2379,7 +2379,8 @@ PyCurses_Putp(PyObject *self, PyObject *args)
23792379
{
23802380
char *str;
23812381

2382-
if (!PyArg_ParseTuple(args,"s;str", &str)) return NULL;
2382+
if (!PyArg_ParseTuple(args,"y;str", &str))
2383+
return NULL;
23832384
return PyCursesCheckERR(putp(str), "putp");
23842385
}
23852386

0 commit comments

Comments
 (0)