@@ -739,16 +739,9 @@ class type_caster_generic {
739
739
// isn't needed or can't be used. If the type is unknown, sets the error and returns a pair
740
740
// with .second = nullptr. (p.first = nullptr is not an error: it becomes None).
741
741
PYBIND11_NOINLINE static std::pair<const void *, const type_info *> src_and_type (
742
- const void *src, const std::type_info &cast_type, const std::type_info *rtti_type = nullptr ) {
743
- if (auto *tpi = get_type_info (cast_type))
744
- return {src, const_cast <const type_info *>(tpi)};
745
-
746
- // Not found, set error:
747
- std::string tname = rtti_type ? rtti_type->name () : cast_type.name ();
748
- detail::clean_type_id (tname);
749
- std::string msg = " Unregistered type : " + tname;
750
- PyErr_SetString (PyExc_TypeError, msg.c_str ());
751
- return {nullptr , nullptr };
742
+ const void *src, const std::type_info &cast_type) {
743
+ auto *tpi = get_type_info (cast_type, true );
744
+ return {src, const_cast <const type_info *>(tpi)};
752
745
}
753
746
754
747
const type_info *typeinfo = nullptr ;
@@ -895,7 +888,7 @@ template <typename type> class type_caster_base : public type_caster_generic {
895
888
}
896
889
// Otherwise we have either a nullptr, an `itype` pointer, or an unknown derived pointer, so
897
890
// don't do a cast
898
- return type_caster_generic::src_and_type (src, cast_type, instance_type );
891
+ return type_caster_generic::src_and_type (src, cast_type);
899
892
}
900
893
901
894
static handle cast (const itype *src, return_value_policy policy, handle parent) {
0 commit comments