diff --git a/include/pybind11/numpy.h b/include/pybind11/numpy.h index 43784f8e9..0291b02d0 100644 --- a/include/pybind11/numpy.h +++ b/include/pybind11/numpy.h @@ -1409,7 +1409,7 @@ PYBIND11_NOINLINE void register_structured_dtype(any_container } auto tindex = std::type_index(tinfo); - numpy_internals.registered_dtypes[tindex] = {dtype_ptr, format_str}; + numpy_internals.registered_dtypes[tindex] = {dtype_ptr, std::move(format_str)}; get_internals().direct_conversions[tindex].push_back(direct_converter); }