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

Skip to content

Commit 88bbd73

Browse files
committed
SF bug #1400822, Extended version of _curses over{lay,write} does not work
Fix signatures to conform to doc (also fixed ungetmouse()). Will backport.
1 parent fc76d63 commit 88bbd73

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

Lib/test/test_curses.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
# does call every method and function.
66
#
77
# Functions not tested: {def,reset}_{shell,prog}_mode, getch(), getstr(),
8-
# getmouse(), ungetmouse(), init_color()
8+
# init_color()
9+
# Only called, not tested: getmouse(), ungetmouse()
910
#
1011

1112
import curses, sys, tempfile, os
@@ -106,6 +107,8 @@ def window_funcs(stdscr):
106107
stdscr.notimeout(1)
107108
win2.overlay(win)
108109
win2.overwrite(win)
110+
win2.overlay(win, 1, 2, 3, 3, 2, 1)
111+
win2.overwrite(win, 1, 2, 3, 3, 2, 1)
109112
stdscr.redrawln(1,2)
110113

111114
stdscr.scrollok(1)
@@ -201,6 +204,9 @@ def module_funcs(stdscr):
201204
if hasattr(curses, 'getmouse'):
202205
curses.mousemask(curses.BUTTON1_PRESSED)
203206
curses.mouseinterval(10)
207+
# just verify these don't cause errors
208+
m = curses.getmouse()
209+
curses.ungetmouse(*m)
204210

205211
def unit_tests():
206212
from curses import ascii

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ Kirill Simonov
552552
Nathan Paul Simons
553553
Janne Sinkkonen
554554
George Sipe
555+
J. Sipprell
555556
Kragen Sitaker
556557
Christopher Smith
557558
Gregory P. Smith

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ Core and builtins
216216
Extension Modules
217217
-----------------
218218

219+
- Bug #1400822, _curses over{lay,write} doesn't work when passing 6 ints.
220+
Also fix ungetmouse() which did not accept arguments properly.
221+
The code now conforms to the documented signature.
222+
219223
- Bug #1400115, Fix segfault when calling curses.panel.userptr()
220224
without prior setting of the userptr.
221225

Modules/_cursesmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ PyCursesWindow_Overlay(PyCursesWindowObject *self, PyObject *args)
11631163
return NULL;
11641164
break;
11651165
case 7:
1166-
if (!PyArg_ParseTuple(args, "(O!iiiiii);window object, int, int, int, int, int, int",
1166+
if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
11671167
&PyCursesWindow_Type, &temp, &sminrow, &smincol,
11681168
&dminrow, &dmincol, &dmaxrow, &dmaxcol))
11691169
return NULL;
@@ -1201,7 +1201,7 @@ PyCursesWindow_Overwrite(PyCursesWindowObject *self, PyObject *args)
12011201
return NULL;
12021202
break;
12031203
case 7:
1204-
if (!PyArg_ParseTuple(args, "(O!iiiiii);window object, int, int, int, int, int, int",
1204+
if (!PyArg_ParseTuple(args, "O!iiiiii;window object, int, int, int, int, int, int",
12051205
&PyCursesWindow_Type, &temp, &sminrow, &smincol,
12061206
&dminrow, &dmincol, &dmaxrow, &dmaxcol))
12071207
return NULL;
@@ -1674,7 +1674,7 @@ PyCurses_UngetMouse(PyObject *self, PyObject *args)
16741674
MEVENT event;
16751675

16761676
PyCursesInitialised
1677-
if (!PyArg_ParseTuple(args, "(hiiil)",
1677+
if (!PyArg_ParseTuple(args, "hiiil",
16781678
&event.id,
16791679
&event.x, &event.y, &event.z,
16801680
(int *) &event.bstate))

0 commit comments

Comments
 (0)