diff --git a/include/pluginplay/python/python_wrapper.hpp b/include/pluginplay/python/python_wrapper.hpp index 5cc0d0061..26e2291c5 100644 --- a/include/pluginplay/python/python_wrapper.hpp +++ b/include/pluginplay/python/python_wrapper.hpp @@ -305,7 +305,7 @@ T PythonWrapper::unwrap() { } // User wants the converted C++ value by reference or const reference else { - if(m_buffer_.empty()) { + if(m_buffer_.empty() || m_buffer_.type() != typeid(clean_type)) { auto cxx_value = py_value.cast(); m_buffer_ = std::move(cxx_value); }