diff --git a/src/pluginplay/detail_/submodule_request_pimpl.ipp b/src/pluginplay/detail_/submodule_request_pimpl.ipp index c00ec8f9..0d8093e9 100644 --- a/src/pluginplay/detail_/submodule_request_pimpl.ipp +++ b/src/pluginplay/detail_/submodule_request_pimpl.ipp @@ -48,11 +48,25 @@ bool SubmoduleRequestPIMPL::satisfies_property_type(rtti_type type) { inline void SubmoduleRequestPIMPL::set_module(module_ptr ptr) { if(!ptr) throw std::runtime_error("Pointer does not contain a module"); // Type will check that a property type was set - if(ptr->property_types().count(type()) == 0) { + bool suitable = (ptr->property_types().count(type()) > 0); + + // Work around for libc++ typeid inconsistency in Python + if(!suitable) { + for(const auto& property_type_info : ptr->property_types()) { + if(type().name() == property_type_info.name() || + std::strcmp(type().name(), property_type_info.name()) == 0) { + suitable = true; + break; + } + } + } + + if(!suitable) { std::string msg("Module does not satisfy property type: "); msg += utilities::printing::Demangler::demangle(type()); throw std::runtime_error(msg); } + m_module_ = ptr; } diff --git a/src/pluginplay/module/module.cpp b/src/pluginplay/module/module.cpp index 650ede77..f5090342 100644 --- a/src/pluginplay/module/module.cpp +++ b/src/pluginplay/module/module.cpp @@ -135,6 +135,14 @@ void Module::add_property_type_(pluginplay::type::rtti prop_type) { void Module::check_property_type_(type::rtti prop_type) { if(property_types().count(prop_type)) return; + + // Work around for libc++ typeid inconsistency in Python + for(const auto& m_prop_type : property_types()) { + if(prop_type.name() == m_prop_type.name() || + std::strcmp(prop_type.name(), m_prop_type.name()) == 0) + return; + } + std::string msg = "Module does not satisfy property type "; msg += utilities::printing::Demangler::demangle(prop_type); throw std::runtime_error(msg);