| 1157 | /// completing the cycle |
| 1158 | template <typename T> |
| 1159 | std::weak_ptr<T> potentially_slicing_weak_ptr(handle obj) { |
| 1160 | detail::make_caster<std::shared_ptr<T>> caster; |
| 1161 | if (caster.load(obj, /*convert=*/true)) { |
| 1162 | return caster.potentially_slicing_weak_ptr(); |
| 1163 | } |
| 1164 | const char *obj_type_name = detail::obj_class_name(obj.ptr()); |
| 1165 | throw type_error("\"" + std::string(obj_type_name) |
| 1166 | + "\" object is not convertible to std::weak_ptr<T> (with T = " + type_id<T>() |
| 1167 | + ")"); |
| 1168 | } |
| 1169 | |
| 1170 | PYBIND11_NAMESPACE_BEGIN(detail) |
| 1171 |
nothing calls this directly
no test coverage detected