Skip to content

Commit 95e7201

Browse files
committed
py: Fix Map.get() again
1 parent 220c946 commit 95e7201

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/pybind11_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ py::class_<Map, holder_type> BindMap(py::handle scope, const std::string& name,
154154
}
155155
return it->second;
156156
},
157-
py::return_value_policy::reference_internal, "key"_a, "default"_a = std::nullopt)
157+
"key"_a, "default"_a = std::nullopt, py::keep_alive<0, 1>())
158158
.def(
159159
"keys", [](const Map& map) { return py::make_key_iterator(map.begin(), map.end()); },
160160
py::keep_alive<0, 1>());

0 commit comments

Comments
 (0)