Fix handle_type_name<anyset> as suggested by @sizmailov:

https://github.com/pybind/pybind11/pull/4888#discussion_r1367775289

NOTE: This is actually a bug fix, in its own right.
This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-10-21 11:20:45 -07:00
parent 199532e989
commit 7280380378
2 changed files with 5 additions and 5 deletions

View File

@ -888,6 +888,10 @@ struct handle_type_name<dict> {
static constexpr auto name = const_name("dict"); static constexpr auto name = const_name("dict");
}; };
template <> template <>
struct handle_type_name<anyset> {
static constexpr auto name = const_name("set");
};
template <>
struct handle_type_name<set> { struct handle_type_name<set> {
static constexpr auto name = const_name("set"); static constexpr auto name = const_name("set");
}; };
@ -896,10 +900,6 @@ struct handle_type_name<frozenset> {
static constexpr auto name = const_name("frozenset"); static constexpr auto name = const_name("frozenset");
}; };
template <> template <>
struct handle_type_name<anyset> {
static constexpr auto name = const_name("anyset");
};
template <>
struct handle_type_name<str> { struct handle_type_name<str> {
static constexpr auto name = const_name("str"); static constexpr auto name = const_name("str");
}; };

View File

@ -121,7 +121,7 @@ def test_set(capture, doc):
assert m.anyset_contains({"foo"}, "foo") assert m.anyset_contains({"foo"}, "foo")
assert doc(m.get_set) == "get_set() -> set" assert doc(m.get_set) == "get_set() -> set"
assert doc(m.print_anyset) == "print_anyset(arg0: anyset) -> None" assert doc(m.print_anyset) == "print_anyset(arg0: set) -> None"
def test_frozenset(capture, doc): def test_frozenset(capture, doc):