diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-03-08 08:21:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 08:21:13 (GMT) |
commit | c4fb41816f6045dd608d4d97266f16feaf974b83 (patch) | |
tree | b5cfbe4d807abebe2ab7f87457b2f2d5c3ce4a4b /Lib/test/test_signal.py | |
parent | 5e6351c1fb193b742e8d05bbf2135c318ff8bb65 (diff) | |
download | cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.zip cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.tar.gz cpython-c4fb41816f6045dd608d4d97266f16feaf974b83.tar.bz2 |
[3.10] GH-102397: Fix segfault from race condition in signal handling (GH-102399) (#102527)
GH-102397: Fix segfault from race condition in signal handling (GH-102399)
(cherry picked from commit 1a84cc007e207f2dd61f86a7fc3d86632fdce72f)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r-- | Lib/test/test_signal.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index c2b5861..294cf38 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -1349,6 +1349,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): |