Skip to content

Commit

Permalink
Fix handle_type_name<anyset> as suggested by @sizmailov:
Browse files Browse the repository at this point in the history
#4888 (comment)

NOTE: This is actually a bug fix, in its own right.
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 21, 2023
1 parent 199532e commit 7280380
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,10 @@ struct handle_type_name<dict> {
static constexpr auto name = const_name("dict");
};
template <>
struct handle_type_name<anyset> {
static constexpr auto name = const_name("set");
};
template <>
struct handle_type_name<set> {
static constexpr auto name = const_name("set");
};
Expand All @@ -896,10 +900,6 @@ struct handle_type_name<frozenset> {
static constexpr auto name = const_name("frozenset");
};
template <>
struct handle_type_name<anyset> {
static constexpr auto name = const_name("anyset");
};
template <>
struct handle_type_name<str> {
static constexpr auto name = const_name("str");
};
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pytypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test_set(capture, doc):
assert m.anyset_contains({"foo"}, "foo")

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):
Expand Down

0 comments on commit 7280380

Please sign in to comment.