Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 69832:2a19d09b08f8 3.2
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.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Wed, 04 May 2011 20:02:30 +0200 |
| parents | dc245d681901 |
| children | cc7ae81cfe91 c892b0321d23 |
line wrap: on
line diff
--- a/Python/ceval.c Wed May 04 18:39:29 2011 +0300 +++ b/Python/ceval.c Wed May 04 20:02:30 2011 +0200 @@ -440,6 +440,12 @@ 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
