summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-04 19:08:28 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-12-04 19:08:28 (GMT)
commit539ee5da6fb2a56869e6c6f4401300b4d5906d76 (patch)
tree98b32fae910ccb41a333319b65fcd19343cedb87 /Lib/test
parent86067c2e17b221ac10c4b4c97030c2cfc44eccaf (diff)
downloadcpython-539ee5da6fb2a56869e6c6f4401300b4d5906d76.zip
cpython-539ee5da6fb2a56869e6c6f4401300b4d5906d76.tar.gz
cpython-539ee5da6fb2a56869e6c6f4401300b4d5906d76.tar.bz2
Issue #13120: Allow to call pdb.set_trace() from thread.
Patch by Ilya Sandler.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pdb.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index d28b042..dc2609e 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -664,6 +664,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)