From da73596e6860fb8c702f5f5c1db703ed2cc2fbe5 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Waldrop" Date: Thu, 12 Jun 2025 15:53:43 -0500 Subject: [PATCH 1/2] double check type_info by name --- .../detail_/submodule_request_pimpl.ipp | 15 ++++++++++++++- src/pluginplay/module/module.cpp | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pluginplay/detail_/submodule_request_pimpl.ipp b/src/pluginplay/detail_/submodule_request_pimpl.ipp index c00ec8f9d..813ee99d9 100644 --- a/src/pluginplay/detail_/submodule_request_pimpl.ipp +++ b/src/pluginplay/detail_/submodule_request_pimpl.ipp @@ -48,11 +48,24 @@ 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()) { + 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 650ede770..7ad12e6ec 100644 --- a/src/pluginplay/module/module.cpp +++ b/src/pluginplay/module/module.cpp @@ -135,6 +135,12 @@ 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()) return; + } + std::string msg = "Module does not satisfy property type "; msg += utilities::printing::Demangler::demangle(prop_type); throw std::runtime_error(msg); From 60a48855cd4e25a15d53b705e53d70cdbe90d5b6 Mon Sep 17 00:00:00 2001 From: "Jonathan M. Waldrop" Date: Thu, 12 Jun 2025 16:38:01 -0500 Subject: [PATCH 2/2] additional check on type name --- src/pluginplay/detail_/submodule_request_pimpl.ipp | 3 ++- src/pluginplay/module/module.cpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/detail_/submodule_request_pimpl.ipp b/src/pluginplay/detail_/submodule_request_pimpl.ipp index 813ee99d9..0d8093e9d 100644 --- a/src/pluginplay/detail_/submodule_request_pimpl.ipp +++ b/src/pluginplay/detail_/submodule_request_pimpl.ipp @@ -53,7 +53,8 @@ inline void SubmoduleRequestPIMPL::set_module(module_ptr ptr) { // 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()) { + if(type().name() == property_type_info.name() || + std::strcmp(type().name(), property_type_info.name()) == 0) { suitable = true; break; } diff --git a/src/pluginplay/module/module.cpp b/src/pluginplay/module/module.cpp index 7ad12e6ec..f5090342d 100644 --- a/src/pluginplay/module/module.cpp +++ b/src/pluginplay/module/module.cpp @@ -138,7 +138,9 @@ void Module::check_property_type_(type::rtti prop_type) { // Work around for libc++ typeid inconsistency in Python for(const auto& m_prop_type : property_types()) { - if(prop_type.name() == m_prop_type.name()) return; + 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 ";