Skip to content

Commit a49a7ce

Browse files
committed
Fix storing deleter for const unique ptr.
Unit test from the previous commit passes.
1 parent ad7eaa4 commit a49a7ce

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/pybind11/detail/smart_holder_type_casters.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,7 +1112,8 @@ struct smart_holder_type_caster<std::unique_ptr<T const, D>>
11121112
static handle
11131113
cast(std::unique_ptr<T const, D> &&src, return_value_policy policy, handle parent) {
11141114
return smart_holder_type_caster<std::unique_ptr<T, D>>::cast(
1115-
std::unique_ptr<T, D>(const_cast<T *>(src.release())), // Const2Mutbl
1115+
std::unique_ptr<T, D>(const_cast<T *>(src.release()),
1116+
std::move(src.get_deleter())), // Const2Mutbl
11161117
policy,
11171118
parent);
11181119
}

0 commit comments

Comments
 (0)