Skip to content

Commit

Permalink
Add struct handle_type_name<...> specializations for object, `lis…
Browse files Browse the repository at this point in the history
…t`, 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
```
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 19, 2023
1 parent 7780fbc commit 76b4a34
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,38 @@ struct handle_type_name {
static constexpr auto name = const_name<T>();
};
template <>
struct handle_type_name<object> {
static constexpr auto name = const_name("object");
};
template <>
struct handle_type_name<list> {
static constexpr auto name = const_name("list");
};
template <>
struct handle_type_name<dict> {
static constexpr auto name = const_name("dict");
};
template <>
struct handle_type_name<set> {
static constexpr auto name = const_name("set");
};
template <>
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");
};
template <>
struct handle_type_name<tuple> {
static constexpr auto name = const_name("tuple");
};
template <>
struct handle_type_name<bool_> {
static constexpr auto name = const_name("bool");
};
Expand Down

0 comments on commit 76b4a34

Please sign in to comment.