Bug fixes: Add missing handle_type_name specializations. (#5073)

* Transfer bug fixes from #4888 wholesale. Full test coverage for all fixes is still missing.

* Add cmake option(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION) and use in some tests.
This commit is contained in:
Ralf W. Grosse-Kunstleve
2024-03-27 12:39:05 -07:00
committed by GitHub
parent 705efccecd
commit 0efff79f01
11 changed files with 156 additions and 5 deletions

View File

@@ -41,6 +41,15 @@ class float_ : public py::object {
};
} // namespace external
namespace pybind11 {
namespace detail {
template <>
struct handle_type_name<external::float_> {
static constexpr auto name = const_name("float");
};
} // namespace detail
} // namespace pybind11
namespace implicit_conversion_from_0_to_handle {
// Uncomment to trigger compiler error. Note: Before PR #4008 this used to compile successfully.
// void expected_to_trigger_compiler_error() { py::handle(0); }