diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-04 19:10:20 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-04 19:10:20 (GMT) |
commit | 1dfb5c1cf3aac0a42b157631a0e8d274e5be8c6f (patch) | |
tree | 90cdb2b13e03256b55a63a62f818c6ce6cc4f497 /Lib/test/test_pdb.py | |
parent | 56a2ae27e3f142f5a92d43fab5296748ef8ecc98 (diff) | |
parent | 539ee5da6fb2a56869e6c6f4401300b4d5906d76 (diff) | |
download | cpython-1dfb5c1cf3aac0a42b157631a0e8d274e5be8c6f.zip cpython-1dfb5c1cf3aac0a42b157631a0e8d274e5be8c6f.tar.gz cpython-1dfb5c1cf3aac0a42b157631a0e8d274e5be8c6f.tar.bz2 |
Merge issue #13120: Allow to call pdb.set_trace() from thread.
Patch by Ilya Sandler.
Diffstat (limited to 'Lib/test/test_pdb.py')
-rw-r--r-- | Lib/test/test_pdb.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py index 0f7a984..4e543dd 100644 --- a/Lib/test/test_pdb.py +++ b/Lib/test/test_pdb.py @@ -667,6 +667,33 @@ class PdbTestCase(unittest.TestCase): any('main.py(5)foo()->None' in l for l in stdout.splitlines()), 'Fail to step into the caller after a return') + def test_issue13210(self): + # invoking "continue" on a non-main thread triggered an exception + # inside signal.signal + + with open(support.TESTFN, 'wb') as f: + f.write(textwrap.dedent(""" + import threading + import pdb + + def start_pdb(): + pdb.Pdb().set_trace() + x = 1 + y = 1 + + t = threading.Thread(target=start_pdb) + t.start()""").encode('ascii')) + cmd = [sys.executable, '-u', support.TESTFN] + proc = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stdin=subprocess.PIPE, + stderr=subprocess.STDOUT, + ) + self.addCleanup(proc.stdout.close) + stdout, stderr = proc.communicate(b'cont\n') + self.assertNotIn('Error', stdout.decode(), + "Got an error running test script under PDB") + def tearDown(self): support.unlink(support.TESTFN) |