MCPcopy Create free account
hub / github.com/pybind/pybind11 / load

Method load

include/pybind11/stl.h:437–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435
436public:
437 bool load(handle src, bool convert) {
438 if (!object_is_convertible_to_std_vector(src)) {
439 return false;
440 }
441 if (isinstance<sequence>(src)) {
442 return convert_elements(src, convert);
443 }
444 if (!convert) {
445 return false;
446 }
447 // Designed to be behavior-equivalent to passing tuple(src) from Python:
448 // The conversion to a tuple will first exhaust the generator object, to ensure that
449 // the generator is not left in an unpredictable (to the caller) partially-consumed
450 // state.
451 assert(isinstance<iterable>(src));
452 return convert_elements(tuple(reinterpret_borrow<iterable>(src)), convert);
453 }
454
455 template <typename T>
456 static handle cast(T &&src, return_value_policy policy, handle parent) {

Callers

nothing calls this directly

Calls 2

tupleClass · 0.85

Tested by

no test coverage detected