summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pdb.py
diff options
context:
space:
mode:
authorXavier de Gaye <xdegaye@users.sourceforge.net>2016-10-12 18:16:05 (GMT)
committerXavier de Gaye <xdegaye@users.sourceforge.net>2016-10-12 18:16:05 (GMT)
commit291417da7fc141e4ede93b804b6532460f2cc528 (patch)
treef3a549756e13db2ec60b6bf9bcecd85ea2fa202e /Lib/test/test_pdb.py
parentebe17e0347944b01a771eae4cee7f2a38cc82e42 (diff)
parent10e54aeaa234f2806b367c66e3fb4ac6568b39f6 (diff)
downloadcpython-291417da7fc141e4ede93b804b6532460f2cc528.zip
cpython-291417da7fc141e4ede93b804b6532460f2cc528.tar.gz
cpython-291417da7fc141e4ede93b804b6532460f2cc528.tar.bz2
Issue #20766: Merge with 3.5.
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r--Lib/test/test_pdb.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 994e088..0ea2af5 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()
+ > <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
+ -> print('pdb %d: %s' % (i, sess._previous_sigint_handler))
+ (Pdb) continue
+ pdb 1: <built-in function default_int_handler>
+ > <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
+ -> sess.set_trace(sys._getframe())
+ (Pdb) continue
+ pdb 2: <built-in function default_int_handler>
+ """
class PdbTestCase(unittest.TestCase):