Skip to content

Commit 27ea0cf

Browse files
committed
Drop constraints on casting of std::shared_ptr
std::shared_ptrs can be shared across python and C++ by design.
1 parent b0e7b98 commit 27ea0cf

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,12 +623,6 @@ struct smart_holder_type_caster<std::shared_ptr<T>> : smart_holder_type_caster_l
623623
static constexpr auto name = _<std::shared_ptr<T>>();
624624

625625
static handle cast(const std::shared_ptr<T> &src, return_value_policy policy, handle parent) {
626-
if (policy != return_value_policy::automatic
627-
&& policy != return_value_policy::reference_internal) {
628-
// SMART_HOLDER_WIP: IMPROVABLE: Error message.
629-
throw cast_error("Invalid return_value_policy for shared_ptr.");
630-
}
631-
632626
auto src_raw_ptr = src.get();
633627
auto st = type_caster_base<T>::src_and_type(src_raw_ptr);
634628
if (st.first == nullptr)

0 commit comments

Comments
 (0)