From 76b4a34aff6e7fd1ae2728588c5fd5914f7320d0 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 19 Oct 2023 15:43:55 -0700 Subject: [PATCH] Add `struct handle_type_name<...>` specializations for `object`, `list`, etc. This resolves all test failures except: ``` E - create_rec_nested(arg0: int) -> numpy.ndarray[Annotated[Any, "NestedStruct"]] ... FAILED test_numpy_dtypes.py::test_signature - assert --- actual / +++ expected ``` --- include/pybind11/cast.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 3c9b7c927..77eb61995 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -874,6 +874,38 @@ struct handle_type_name { static constexpr auto name = const_name(); }; template <> +struct handle_type_name { + static constexpr auto name = const_name("object"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("list"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("dict"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("set"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("frozenset"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("anyset"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("str"); +}; +template <> +struct handle_type_name { + static constexpr auto name = const_name("tuple"); +}; +template <> struct handle_type_name { static constexpr auto name = const_name("bool"); };