From b8876ac2af516a0b5e3773e3f76a2de355c74cf1 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 21 Jun 2022 02:48:53 -0700 Subject: [PATCH] Strip ./ from source_file_line --- include/pybind11/cast.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 5f7f3a369..9d7200e0b 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -63,6 +63,10 @@ bool odr_guard_impl(const std::type_index &it_ti, const char *tc_id) { fflush(stdout); #endif std::string tc_id_str{tc_id}; + if (tc_id_str.size() > 2 && tc_id_str[0] == '.' + && (tc_id_str[1] == '/' || tc_id_str[1] == '\\')) { + tc_id_str = tc_id_str.substr(2); + } auto [reg_iter, added] = odr_guard_registry().insert({it_ti, tc_id_str}); if (!added && reg_iter->second != tc_id_str) { std::system_error err(std::make_error_code(std::errc::state_not_recoverable),