summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2023-03-08 07:59:39 (GMT)
committerGitHub <noreply@github.com>2023-03-08 07:59:39 (GMT)
commit1a84cc007e207f2dd61f86a7fc3d86632fdce72f (patch)
tree9304ca9358fe51e85ecbcb7b010d132e4e9c1450 /Lib/test
parent061325e0d2bbec6ff89d03f527c91dc7bfa14003 (diff)
downloadcpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.zip
cpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.tar.gz
cpython-1a84cc007e207f2dd61f86a7fc3d86632fdce72f.tar.bz2
GH-102397: Fix segfault from race condition in signal handling (#102399)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_signal.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 2562a57..25afd6a 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -1406,6 +1406,21 @@ class RaiseSignalTest(unittest.TestCase):
signal.raise_signal(signal.SIGINT)
self.assertTrue(is_ok)
+ def test__thread_interrupt_main(self):
+ # See https://github.com/python/cpython/issues/102397
+ code = """if 1:
+ import _thread
+ class Foo():
+ def __del__(self):
+ _thread.interrupt_main()
+
+ x = Foo()
+ """
+
+ rc, out, err = assert_python_ok('-c', code)
+ self.assertIn(b'OSError: Signal 2 ignored due to race condition', err)
+
+
class PidfdSignalTest(unittest.TestCase):