Skip to content

Commit 80a9ce2

Browse files
Debug.
1 parent d89dbb1 commit 80a9ce2

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Lib/test/test_curses.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,16 @@ def test_pair_content(self):
382382
(curses.COLOR_WHITE, curses.COLOR_BLACK))
383383
curses.pair_content(0)
384384
maxpair = curses.COLOR_PAIRS - 1
385-
if maxpair > 0:
386-
curses.pair_content(maxpair)
385+
err = None
386+
while maxpair > 0:
387+
try:
388+
curses.pair_content(maxpair)
389+
break
390+
except curses.error as e:
391+
err = e
392+
maxpair -= 1
393+
if err is not None:
394+
raise err
387395

388396
for pair in self.bad_pairs():
389397
self.assertRaises(ValueError, curses.pair_content, pair)

Modules/_cursesmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3866,7 +3866,8 @@ _curses_pair_content_impl(PyObject *module, int pair_number)
38663866
if (_CURSES_PAIR_CONTENT_FUNC(pair_number, &f, &b) == ERR) {
38673867
if (pair_number >= COLOR_PAIRS) {
38683868
PyErr_Format(PyExc_ValueError,
3869-
"Color pair is greater than COLOR_PAIRS-1 (%d).",
3869+
"Color pair %d is greater than COLOR_PAIRS-1 (%d).",
3870+
pair_number,
38703871
COLOR_PAIRS - 1);
38713872
}
38723873
else {

0 commit comments

Comments
 (0)