summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_curses.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-01-09 06:24:35 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-01-09 06:24:35 (GMT)
commit5e3d862392acc3b6862c6393bfbca7450523717d (patch)
tree8db6622c03bd525d1d3c7a9af5cbbebd76537225 /Lib/test/test_curses.py
parente0aec6df5e9549bd9e2c54ea57b6aa65d3c25f29 (diff)
downloadcpython-5e3d862392acc3b6862c6393bfbca7450523717d.zip
cpython-5e3d862392acc3b6862c6393bfbca7450523717d.tar.gz
cpython-5e3d862392acc3b6862c6393bfbca7450523717d.tar.bz2
Bug #1400115, Fix segfault when calling curses.panel.userptr()
without prior setting of the userptr. Will backport.
Diffstat (limited to 'Lib/test/test_curses.py')
-rw-r--r--Lib/test/test_curses.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index e137d31..6f843ad 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -9,6 +9,7 @@
#
import curses, sys, tempfile, os
+import curses.panel
# Optionally test curses module. This currently requires that the
# 'curses' resource be given on the regrtest command line using the -u
@@ -213,12 +214,22 @@ def unit_tests():
print 'curses.unctrl fails on character', repr(ch)
+def test_userptr_without_set(stdscr):
+ w = curses.newwin(10, 10)
+ p = curses.panel.new_panel(w)
+ # try to access userptr() before calling set_userptr() -- segfaults
+ try:
+ p.userptr()
+ raise RuntimeError, 'userptr should fail since not set'
+ except curses.panel.error:
+ pass
def main(stdscr):
curses.savetty()
try:
module_funcs(stdscr)
window_funcs(stdscr)
+ test_userptr_without_set(stdscr)
finally:
curses.resetty()