From 10e54aeaa234f2806b367c66e3fb4ac6568b39f6 Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Wed, 12 Oct 2016 20:13:24 +0200 Subject: Issue #20766: Fix references leaked by pdb in the handling of SIGINT handlers. --- Lib/test/test_pdb.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Lib/test/test_pdb.py') diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 45ba5a9685..66a7b5573c 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -911,6 +911,29 @@ def test_pdb_next_command_subiterator(): (Pdb) continue """ +def test_pdb_issue_20766(): + """Test for reference leaks when the SIGINT handler is set. + + >>> def test_function(): + ... i = 1 + ... while i <= 2: + ... sess = pdb.Pdb() + ... sess.set_trace(sys._getframe()) + ... print('pdb %d: %s' % (i, sess._previous_sigint_handler)) + ... i += 1 + + >>> with PdbTestInput(['continue', + ... 'continue']): + ... test_function() + > (6)test_function() + -> print('pdb %d: %s' % (i, sess._previous_sigint_handler)) + (Pdb) continue + pdb 1: + > (5)test_function() + -> sess.set_trace(sys._getframe()) + (Pdb) continue + pdb 2: + """ class PdbTestCase(unittest.TestCase): -- cgit v1.2.1