diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index b3c8ebe17..8a4e2e647 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -898,6 +898,10 @@ struct handle_type_name { static constexpr auto name = const_name("float"); }; template <> +struct handle_type_name { + static constexpr auto name = const_name("Callable"); +}; +template <> struct handle_type_name { static constexpr auto name = const_name("None"); }; diff --git a/tests/test_callbacks.py b/tests/test_callbacks.py index 4a652f53e..86c767455 100644 --- a/tests/test_callbacks.py +++ b/tests/test_callbacks.py @@ -216,3 +216,10 @@ def test_custom_func(): def test_custom_func2(): assert m.custom_function2(3) == 27 assert m.roundtrip(m.custom_function2)(3) == 27 + + +def test_callback_docstring(): + assert ( + m.test_tuple_unpacking.__doc__.strip() + == "test_tuple_unpacking(arg0: Callable) -> object" + )