summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_curses.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-28 08:16:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-28 08:16:06 (GMT)
commitbdf9e0ea7473bcdb7f4c01f4b76db875ec8bc64e (patch)
tree63c9a846600e877c25717a872be03ffe9aa0d39d /Lib/test/test_curses.py
parent283de2b9c18e38c9a573526d6c398ade7dd6f8e9 (diff)
downloadcpython-bdf9e0ea7473bcdb7f4c01f4b76db875ec8bc64e.zip
cpython-bdf9e0ea7473bcdb7f4c01f4b76db875ec8bc64e.tar.gz
cpython-bdf9e0ea7473bcdb7f4c01f4b76db875ec8bc64e.tar.bz2
Issue #13051: Fixed recursion errors in large or resized curses.textpad.Textbox.
Based on patch by Tycho Andersen.
Diffstat (limited to 'Lib/test/test_curses.py')
-rw-r--r--Lib/test/test_curses.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 25284ad..14ba87f 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -27,6 +27,7 @@ requires('curses')
curses = import_module('curses')
import_module('curses.panel')
import_module('curses.ascii')
+import_module('curses.textpad')
def requires_curses_func(name):
return unittest.skipUnless(hasattr(curses, name),
@@ -392,6 +393,14 @@ class TestCurses(unittest.TestCase):
human_readable_signature = stdscr.addch.__doc__.split("\n")[0]
self.assertIn("[y, x,]", human_readable_signature)
+ def test_issue13051(self):
+ stdscr = self.stdscr
+ box = curses.textpad.Textbox(stdscr, insert_mode=True)
+ lines, cols = stdscr.getmaxyx()
+ stdscr.resize(lines-2, cols-2)
+ # this may cause infinite recursion, leading to a RuntimeError
+ box._insert_printable_char('a')
+
class MiscTests(unittest.TestCase):