From bb8709a0d6cc0b77ee54a6a6296ca63d65bc3c28 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Sat, 21 Oct 2023 11:09:09 -0700 Subject: [PATCH] Remove `cpp_name_needs_typing_annotated()`. Preparation for bringing back commit 76b4a34aff6e7fd1ae2728588c5fd5914f7320d0. --- include/pybind11/pybind11.h | 6 +----- include/pybind11/typing.h | 10 ---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index d51a0c6fb..f3bccd824 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -493,11 +493,7 @@ protected: } else { std::string tname(t->name()); detail::clean_type_id(tname); - if (detail::cpp_name_needs_typing_annotated(tname.c_str())) { - signature += "Annotated[Any, CppTypePybind11(\"" + tname + "\")]"; - } else { - signature += tname; - } + signature += "Annotated[Any, CppTypePybind11(\"" + tname + "\")]"; } } else { signature += c; diff --git a/include/pybind11/typing.h b/include/pybind11/typing.h index c489c6d3a..b7b1a4e54 100644 --- a/include/pybind11/typing.h +++ b/include/pybind11/typing.h @@ -113,15 +113,5 @@ struct handle_type_name> { + const_name("]"); }; -inline bool cpp_name_needs_typing_annotated(const char *cpp_name) { - while (*cpp_name != '\0') { - char c = *cpp_name++; - if (c == ':' || c == '<') { // Assuming valid names, there is no need to check for '>'. - return true; - } - } - return false; -} - PYBIND11_NAMESPACE_END(detail) PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)