diff --git a/tests/test_embed/test_interpreter.cpp b/tests/test_embed/test_interpreter.cpp index 2d5823c39..acbad6bec 100644 --- a/tests/test_embed/test_interpreter.cpp +++ b/tests/test_embed/test_interpreter.cpp @@ -205,7 +205,7 @@ TEST_CASE("Threads") { for (auto i = 0; i < num_threads; ++i) { threads.emplace_back([&]() { py::gil_scoped_acquire gil{}; - py::exec("count += 1", py::globals(), locals); + locals["count"] = locals["count"].cast() + 1; }); }