Skip to content

Commit 813660c

Browse files
committed
Change annotated_any() to quote_cpp_type_name()
1 parent 6b771d5 commit 813660c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/pybind11/detail/type_caster_base.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,8 @@ class type_caster_base : public type_caster_generic {
12011201
static Constructor make_move_constructor(...) { return nullptr; }
12021202
};
12031203

1204-
inline std::string annotated_any(const std::string &cpp_type) {
1205-
return "Annotated[Any, pybind11.CppType(\"" + cpp_type + "\")]";
1204+
inline std::string quote_cpp_type_name(const std::string &cpp_type_name) {
1205+
return "`" + cpp_type_name + "`"; // See PR #4888
12061206
}
12071207

12081208
PYBIND11_NOINLINE std::string type_info_description(const std::type_info &ti) {
@@ -1211,7 +1211,7 @@ PYBIND11_NOINLINE std::string type_info_description(const std::type_info &ti) {
12111211
return th.attr("__module__").cast<std::string>() + '.'
12121212
+ th.attr("__qualname__").cast<std::string>();
12131213
}
1214-
return annotated_any(clean_type_id(ti.name()));
1214+
return quote_cpp_type_name(clean_type_id(ti.name()));
12151215
}
12161216

12171217
PYBIND11_NAMESPACE_END(detail)

include/pybind11/pybind11.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class cpp_function : public function {
492492
signature += rec->scope.attr("__module__").cast<std::string>() + "."
493493
+ rec->scope.attr("__qualname__").cast<std::string>();
494494
} else {
495-
signature += detail::annotated_any(detail::clean_type_id(t->name()));
495+
signature += detail::quote_cpp_type_name(detail::clean_type_id(t->name()));
496496
}
497497
} else {
498498
signature += c;

0 commit comments

Comments
 (0)