mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Propagate exceptions in sequence::size() (#2076)
This commit is contained in:
committed by
Wenzel Jakob
parent
805c5862b6
commit
02c83dba0f
@@ -319,6 +319,9 @@ TEST_SUBMODULE(sequences_and_iterators, m) {
|
||||
return l;
|
||||
});
|
||||
|
||||
// test_sequence_length: check that Python sequences can be converted to py::sequence.
|
||||
m.def("sequence_length", [](py::sequence seq) { return seq.size(); });
|
||||
|
||||
// Make sure that py::iterator works with std algorithms
|
||||
m.def("count_none", [](py::object o) {
|
||||
return std::count_if(o.begin(), o.end(), [](py::handle h) { return h.is_none(); });
|
||||
|
||||
Reference in New Issue
Block a user