Skip to content

Commit

Permalink
Explicit py::gil_scoped_release() in test_interpreter.cpp `TEST_CAS…
Browse files Browse the repository at this point in the history
…E("Threads")`
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 6, 2022
1 parent 7bbc06e commit e70b38b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_embed/test_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,13 @@ TEST_CASE("Threads") {
auto locals = py::dict("count"_a = 0);

{
py::gil_scoped_release gil_release{};
// This used to be triggered by py::gil_scoped_release().
// TODO: Explain why/how this is relevant to this unit test.
py::detail::get_internals();
REQUIRE(has_pybind11_internals_static());

py::gil_scoped_release gil_release{};

auto threads = std::vector<std::thread>();
for (auto i = 0; i < num_threads; ++i) {
threads.emplace_back([&]() {
Expand Down

0 comments on commit e70b38b

Please sign in to comment.