@@ -881,10 +881,53 @@ struct is_holder_type
881
881
template <typename base, typename deleter>
882
882
struct is_holder_type <base, std::unique_ptr<base, deleter>> : std::true_type {};
883
883
884
+ #ifdef PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION // See PR #4888
885
+
886
+ // This leads to compilation errors if a specialization is missing.
887
+ template <typename T>
888
+ struct handle_type_name ;
889
+
890
+ #else
891
+
884
892
template <typename T>
885
893
struct handle_type_name {
886
894
static constexpr auto name = const_name<T>();
887
895
};
896
+
897
+ #endif
898
+
899
+ template <>
900
+ struct handle_type_name <object> {
901
+ static constexpr auto name = const_name(" object" );
902
+ };
903
+ template <>
904
+ struct handle_type_name <list> {
905
+ static constexpr auto name = const_name(" list" );
906
+ };
907
+ template <>
908
+ struct handle_type_name <dict> {
909
+ static constexpr auto name = const_name(" dict" );
910
+ };
911
+ template <>
912
+ struct handle_type_name <anyset> {
913
+ static constexpr auto name = const_name(" Union[set, frozenset]" );
914
+ };
915
+ template <>
916
+ struct handle_type_name <set> {
917
+ static constexpr auto name = const_name(" set" );
918
+ };
919
+ template <>
920
+ struct handle_type_name <frozenset> {
921
+ static constexpr auto name = const_name(" frozenset" );
922
+ };
923
+ template <>
924
+ struct handle_type_name <str> {
925
+ static constexpr auto name = const_name(" str" );
926
+ };
927
+ template <>
928
+ struct handle_type_name <tuple> {
929
+ static constexpr auto name = const_name(" tuple" );
930
+ };
888
931
template <>
889
932
struct handle_type_name <bool_> {
890
933
static constexpr auto name = const_name(" bool" );
@@ -930,13 +973,65 @@ struct handle_type_name<sequence> {
930
973
static constexpr auto name = const_name(" Sequence" );
931
974
};
932
975
template <>
976
+ struct handle_type_name <bytearray> {
977
+ static constexpr auto name = const_name(" bytearray" );
978
+ };
979
+ template <>
980
+ struct handle_type_name <memoryview> {
981
+ static constexpr auto name = const_name(" memoryview" );
982
+ };
983
+ template <>
984
+ struct handle_type_name <slice> {
985
+ static constexpr auto name = const_name(" slice" );
986
+ };
987
+ template <>
988
+ struct handle_type_name <type> {
989
+ static constexpr auto name = const_name(" type" );
990
+ };
991
+ template <>
992
+ struct handle_type_name <capsule> {
993
+ static constexpr auto name = const_name(" capsule" );
994
+ };
995
+ template <>
996
+ struct handle_type_name <ellipsis> {
997
+ static constexpr auto name = const_name(" ellipsis" );
998
+ };
999
+ template <>
1000
+ struct handle_type_name <weakref> {
1001
+ static constexpr auto name = const_name(" weakref" );
1002
+ };
1003
+ template <>
933
1004
struct handle_type_name <args> {
934
1005
static constexpr auto name = const_name(" *args" );
935
1006
};
936
1007
template <>
937
1008
struct handle_type_name <kwargs> {
938
1009
static constexpr auto name = const_name(" **kwargs" );
939
1010
};
1011
+ template <>
1012
+ struct handle_type_name <obj_attr_accessor> {
1013
+ static constexpr auto name = const_name<obj_attr_accessor>();
1014
+ };
1015
+ template <>
1016
+ struct handle_type_name <str_attr_accessor> {
1017
+ static constexpr auto name = const_name<str_attr_accessor>();
1018
+ };
1019
+ template <>
1020
+ struct handle_type_name <item_accessor> {
1021
+ static constexpr auto name = const_name<item_accessor>();
1022
+ };
1023
+ template <>
1024
+ struct handle_type_name <sequence_accessor> {
1025
+ static constexpr auto name = const_name<sequence_accessor>();
1026
+ };
1027
+ template <>
1028
+ struct handle_type_name <list_accessor> {
1029
+ static constexpr auto name = const_name<list_accessor>();
1030
+ };
1031
+ template <>
1032
+ struct handle_type_name <tuple_accessor> {
1033
+ static constexpr auto name = const_name<tuple_accessor>();
1034
+ };
940
1035
941
1036
template <typename type>
942
1037
struct pyobject_caster {
0 commit comments