mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
* Clear local internals after finalizing interpreter * Add descriptive comments * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -375,3 +375,21 @@ TEST_CASE("sys.argv gets initialized properly") {
|
||||
}
|
||||
py::initialize_interpreter();
|
||||
}
|
||||
|
||||
TEST_CASE("make_iterator can be called before then after finalizing an interpreter") {
|
||||
// Reproduction of issue #2101 (https://github.com/pybind/pybind11/issues/2101)
|
||||
py::finalize_interpreter();
|
||||
|
||||
std::vector<int> container;
|
||||
{
|
||||
pybind11::scoped_interpreter g;
|
||||
auto iter = pybind11::make_iterator(container.begin(), container.end());
|
||||
}
|
||||
|
||||
REQUIRE_NOTHROW([&]() {
|
||||
pybind11::scoped_interpreter g;
|
||||
auto iter = pybind11::make_iterator(container.begin(), container.end());
|
||||
}());
|
||||
|
||||
py::initialize_interpreter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user