cpython/Lib/test/test_importlib
Brett Simmers be1dfccdf2
gh-118727: Don't drop the GIL in `drop_gil()` unless the current thread holds it (#118745)
`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.
2024-05-23 16:59:35 -04:00
..
builtin
extension gh-116322: Add Py_mod_gil module slot (#116882) 2024-05-03 11:30:55 -04:00
frozen
import_ gh-112414: Add additional unit tests for calling `repr()` on a namespace package (#112475) 2023-11-28 00:09:59 +00:00
metadata gh-117089: Apply changes from importlib_metadata 7.1.0 (#117094) 2024-03-20 23:01:24 -04:00
namespace_pkgs
partial
resources gh-116608: Ignore UTF-16 BOM in importlib.resources._functional tests (GH-117569) 2024-04-05 17:00:29 +02:00
source
__init__.py
__main__.py
abc.py
test_abc.py
test_api.py
test_lazy.py gh-117182: Allow lazily loaded modules to modify their own __class__ 2024-04-09 04:08:48 +01:00
test_locks.py gh-109974: Fix more threading lock_tests race conditions (#110089) 2023-09-29 12:21:18 +00:00
test_namespace_pkgs.py gh-112414: Fix `AttributeError` when calling `repr()` on a namespace package imported with a custom loader (#112425) 2023-11-27 08:19:29 +00:00
test_pkg_import.py
test_spec.py GH-115979: update test_importlib to work under WASI SDK 21 (GH-116754) 2024-03-13 13:24:28 -07:00
test_threaded_import.py gh-118727: Don't drop the GIL in `drop_gil()` unless the current thread holds it (#118745) 2024-05-23 16:59:35 -04:00
test_util.py gh-76785: Rename _xxsubinterpreters to _interpreters (gh-117791) 2024-04-24 16:18:24 +00:00
test_windows.py gh-112535: Add test on _Py_ThreadId() (#112709) 2023-12-04 22:40:06 +00:00
threaded_import_hangers.py
util.py gh-116303: Skip test module dependent tests if test modules are unavailable (#117341) 2024-04-03 15:11:36 +02:00