| 435 | |
| 436 | public: |
| 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) { |
nothing calls this directly
no test coverage detected