diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-04 18:04:29 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-05-04 18:04:29 (GMT) |
commit | fc20b0c65c446f79e39d006f3cffed03aa745380 (patch) | |
tree | d26d9bdfcce057847cc8b878621ac59ad547c695 /Python/ceval.c | |
parent | c17c6d95cf989a89d77ab4a655599531479bd268 (diff) | |
parent | 0d5e52d3469a310001afe50689f77ddba6d554d1 (diff) | |
download | cpython-fc20b0c65c446f79e39d006f3cffed03aa745380.zip cpython-fc20b0c65c446f79e39d006f3cffed03aa745380.tar.gz cpython-fc20b0c65c446f79e39d006f3cffed03aa745380.tar.bz2 |
Issue #1856: Avoid crashes and lockups when daemon threads run while the
interpreter is shutting down; instead, these threads are now killed when
they try to take the GIL.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index 50d5aac..5627e83 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -440,6 +440,12 @@ PyEval_RestoreThread(PyThreadState *tstate) if (gil_created()) { int err = errno; take_gil(tstate); + /* _Py_Finalizing is protected by the GIL */ + if (_Py_Finalizing && tstate != _Py_Finalizing) { + drop_gil(tstate); + PyThread_exit_thread(); + assert(0); /* unreachable */ + } errno = err; } #endif |