diff options
author | Andrew Kuchling <amk@amk.ca> | 2013-06-15 18:04:04 (GMT) |
---|---|---|
committer | Andrew Kuchling <amk@amk.ca> | 2013-06-15 18:04:04 (GMT) |
commit | 53e5ea7951b674ed223ae8dd3bb2da595d685ec5 (patch) | |
tree | c85508389860c9d6450e142dab8d60d336835583 /Lib/test | |
parent | 27bbfdbc4c85011b2bd7f21d3fe3b5e8c2d8b725 (diff) | |
download | cpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.zip cpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.tar.gz cpython-53e5ea7951b674ed223ae8dd3bb2da595d685ec5.tar.bz2 |
#18113: Objects associated to a curses.panel object with set_userptr() were leaked.
Reported by Atsuo Ishimoto.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_curses.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index e959622..76812b7 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -252,6 +252,18 @@ def test_userptr_without_set(stdscr): except curses.panel.error: pass +def test_userptr_memory_leak(stdscr): + w = curses.newwin(10, 10) + p = curses.panel.new_panel(w) + obj = object() + nrefs = sys.getrefcount(obj) + for i in range(100): + p.set_userptr(obj) + + p.set_userptr(None) + if sys.getrefcount(obj) != nrefs: + raise RuntimeError("set_userptr leaked references") + def test_resize_term(stdscr): if hasattr(curses, 'resizeterm'): lines, cols = curses.LINES, curses.COLS @@ -317,6 +329,7 @@ def main(stdscr): module_funcs(stdscr) window_funcs(stdscr) test_userptr_without_set(stdscr) + test_userptr_memory_leak(stdscr) test_resize_term(stdscr) test_issue6243(stdscr) test_unget_wch(stdscr) |