mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
GH-102397: Fix segfault from race condition in signal handling (#102399)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
061325e0d2
commit
1a84cc007e
3 changed files with 21 additions and 0 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue