Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8e5eb9 commit b1dc1aaCopy full SHA for b1dc1aa
5 files changed
Doc/library/curses.rst
@@ -915,6 +915,9 @@ the following methods and attributes:
915
determining what subset of the screen windows enclose the location of a mouse
916
event.
917
918
+ .. versionchanged:: 3.10
919
+ Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``.
920
+
921
922
.. attribute:: window.encoding
923
Lib/test/test_curses.py
@@ -566,13 +566,12 @@ def test_resize(self):
566
@requires_curses_window_meth('enclose')
567
def test_enclose(self):
568
win = curses.newwin(5, 15, 2, 5)
569
- # TODO: Return bool instead of 1/0
570
- self.assertTrue(win.enclose(2, 5))
571
- self.assertFalse(win.enclose(1, 5))
572
- self.assertFalse(win.enclose(2, 4))
573
- self.assertTrue(win.enclose(6, 19))
574
- self.assertFalse(win.enclose(7, 19))
575
- self.assertFalse(win.enclose(6, 20))
+ self.assertIs(win.enclose(2, 5), True)
+ self.assertIs(win.enclose(1, 5), False)
+ self.assertIs(win.enclose(2, 4), False)
+ self.assertIs(win.enclose(6, 19), True)
+ self.assertIs(win.enclose(7, 19), False)
+ self.assertIs(win.enclose(6, 20), False)
576
577
def test_putwin(self):
578
win = curses.newwin(5, 12, 1, 2)
Misc/NEWS.d/next/Library/2021-01-31-17-31-13.bpo-43084.i8nLpK.rst
@@ -0,0 +1,2 @@
1
+:func:`curses.window.enclose` returns now ``True`` or ``False`` (as was
2
+documented) instead of ``1`` or ``0``.
Modules/_cursesmodule.c
@@ -1343,7 +1343,7 @@ _curses_window_echochar_impl(PyCursesWindowObject *self, PyObject *ch,
1343
1344
#ifdef NCURSES_MOUSE_VERSION
1345
/*[clinic input]
1346
-_curses.window.enclose -> long
+_curses.window.enclose
1347
1348
y: int
1349
Y-coordinate.
@@ -1354,11 +1354,11 @@ _curses.window.enclose -> long
1354
Return True if the screen-relative coordinates are enclosed by the window.
1355
[clinic start generated code]*/
1356
1357
-static long
+static PyObject *
1358
_curses_window_enclose_impl(PyCursesWindowObject *self, int y, int x)
1359
-/*[clinic end generated code: output=5251c961cbe3df63 input=dfe1d9d4d05d8642]*/
+/*[clinic end generated code: output=8679beef50502648 input=4fd3355d723f7bc9]*/
1360
{
1361
- return wenclose(self->win, y, x);
+ return PyBool_FromLong(wenclose(self->win, y, x));
1362
}
1363
#endif
1364
Modules/clinic/_cursesmodule.c.h
0 commit comments