bpo-36250: ignore ValueError from signal in non-main thread (GH-12251)
Authored-By: blueyed <github@thequod.de>
(cherry picked from commit 8d64bfafdffd9f866bb6ac2e5b4c4bdfcb16aea0)
Co-authored-by: Daniel Hahler <github@thequod.de>
diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
index 16d245a..4c38e91 100644
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -1333,6 +1333,35 @@
self.assertNotIn('Error', stdout.decode(),
"Got an error running test script under PDB")
+ def test_issue36250(self):
+
+ with open(support.TESTFN, 'wb') as f:
+ f.write(textwrap.dedent("""
+ import threading
+ import pdb
+
+ evt = threading.Event()
+
+ def start_pdb():
+ evt.wait()
+ pdb.Pdb(readrc=False).set_trace()
+
+ t = threading.Thread(target=start_pdb)
+ t.start()
+ pdb.Pdb(readrc=False).set_trace()
+ evt.set()
+ t.join()""").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\ncont\n')
+ self.assertNotIn('Error', stdout.decode(),
+ "Got an error running test script under PDB")
+
def test_issue16180(self):
# A syntax error in the debuggee.
script = "def f: pass\n"