diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index 659505d87..50828a012 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -199,9 +199,9 @@ private: public: bool load(handle src, bool convert) { - if (!isinstance(src)) + if (!isinstance(src)) return false; - auto l = reinterpret_borrow(src); + auto l = reinterpret_borrow(src); if (!require_size(l.size())) return false; size_t ctr = 0; diff --git a/tests/test_stl.cpp b/tests/test_stl.cpp index 8736ea86d..0bb6433d1 100644 --- a/tests/test_stl.cpp +++ b/tests/test_stl.cpp @@ -263,4 +263,6 @@ TEST_SUBMODULE(stl, m) { return result; }, py::return_value_policy::take_ownership); + + m.def("array_cast_sequence", [](std::array x) { return x; }); } diff --git a/tests/test_stl.py b/tests/test_stl.py index b78f86a24..9e58223c0 100644 --- a/tests/test_stl.py +++ b/tests/test_stl.py @@ -216,3 +216,7 @@ def test_stl_ownership(): assert len(r) == 1 del r assert cstats.alive() == 0 + + +def test_array_cast_sequence(): + assert m.array_cast_sequence((1, 2, 3)) == [1, 2, 3]