return value policy fix for functions returning std::shared_ptr<> (fixes #187)
diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
index b5b3ae0..481c78a 100644
--- a/include/pybind11/cast.h
+++ b/include/pybind11/cast.h
@@ -720,7 +720,7 @@
static handle cast(const holder_type &src, return_value_policy policy, handle parent) {
return type_caster_generic::cast(
- src.get(), policy, parent,
+ src.get(), return_value_policy::take_ownership, parent,
src.get() ? &typeid(*src.get()) : nullptr, &typeid(type),
©_constructor, &move_constructor, &src);
}