Skip to content

Commit

Permalink
style: pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Feb 22, 2025
1 parent f75b750 commit 5a9755e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 6 additions & 5 deletions include/pybind11/functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ struct type_caster<std::function<Return(Args...)>> {
return cpp_function(std::forward<Func>(f_), policy).release();
}

PYBIND11_TYPE_CASTER(type,
const_name("Callable[[")
+ ::pybind11::detail::concat(::pybind11::detail::arg_descr(make_caster<Args>::name)...)
+ const_name("], ") + ::pybind11::detail::return_descr(make_caster<retval_type>::name)
+ const_name("]"));
PYBIND11_TYPE_CASTER(
type,
const_name("Callable[[")
+ ::pybind11::detail::concat(::pybind11::detail::arg_descr(make_caster<Args>::name)...)
+ const_name("], ") + ::pybind11::detail::return_descr(make_caster<retval_type>::name)
+ const_name("]"));
};

PYBIND11_NAMESPACE_END(detail)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ def test_function_signatures(doc):
doc(m.test_callback3)
== "test_callback3(arg0: Callable[[typing.SupportsInt], int]) -> str"
)
assert doc(m.test_callback4) == "test_callback4() -> Callable[[typing.SupportsInt], int]"
assert (
doc(m.test_callback4)
== "test_callback4() -> Callable[[typing.SupportsInt], int]"
)


def test_movable_object():
Expand Down

0 comments on commit 5a9755e

Please sign in to comment.