mirror of
https://github.com/python/cpython.git
synced 2026-01-03 05:54:03 +00:00
`drop_gil()` assumes that its caller is attached, which means that the current thread holds the GIL if and only if the GIL is enabled, and the enabled-state of the GIL won't change. This isn't true, though, because `detach_thread()` calls `_PyEval_ReleaseLock()` after detaching and `_PyThreadState_DeleteCurrent()` calls it after removing the current thread from consideration for stop-the-world requests (effectively detaching it). Fix this by remembering whether or not a thread acquired the GIL when it last attached, in `PyThreadState._status.holds_gil`, and check this in `drop_gil()` instead of `gil->enabled`. This fixes a crash in `test_multiprocessing_pool_circular_import()`, so I've reenabled it. |
||
|---|---|---|
| .. | ||
| builtin | ||
| extension | ||
| frozen | ||
| import_ | ||
| metadata | ||
| namespace_pkgs | ||
| partial | ||
| resources | ||
| source | ||
| __init__.py | ||
| __main__.py | ||
| abc.py | ||
| test_abc.py | ||
| test_api.py | ||
| test_lazy.py | ||
| test_locks.py | ||
| test_namespace_pkgs.py | ||
| test_pkg_import.py | ||
| test_spec.py | ||
| test_threaded_import.py | ||
| test_util.py | ||
| test_windows.py | ||
| threaded_import_hangers.py | ||
| util.py | ||