summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2021-02-15 21:35:48 (GMT)
committerGitHub <noreply@github.com>2021-02-15 21:35:48 (GMT)
commitab2d48163901c9635401db0f6d784c45482d17ec (patch)
tree3118b0efb9e41aa7365c6c9821a78f0c60087da5
parenta2f0654b0a5b4c4f726155620002cc1f5f2d206a (diff)
downloadcpython-ab2d48163901c9635401db0f6d784c45482d17ec.zip
cpython-ab2d48163901c9635401db0f6d784c45482d17ec.tar.gz
cpython-ab2d48163901c9635401db0f6d784c45482d17ec.tar.bz2
bpo-43231: Fix test.test_curses.TestCurses.test_init_pair when running under -R (GH-24539)
-rw-r--r--Lib/test/test_curses.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index a9f7001..f6bd27d 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -926,6 +926,13 @@ class TestCurses(unittest.TestCase):
if (not curses.has_extended_color_support()
or (6, 1) <= curses.ncurses_version < (6, 2)):
pair_limit = min(pair_limit, SHORT_MAX)
+ # If use_default_colors() is called, the upper limit of the extended
+ # range may be restricted, so we need to check if the limit is still
+ # correct
+ try:
+ curses.init_pair(pair_limit, 0, 0)
+ except ValueError:
+ pair_limit = curses.COLOR_PAIRS
return pair_limit
@requires_colors