Skip to content

feat(types): updated py::capsule type hint to use new types.CapsuleType #5567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/pybind11/cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class type_caster<void> : public type_caster<void_type> {
template <typename T>
using cast_op_type = void *&;
explicit operator void *&() { return value; }
static constexpr auto name = const_name("capsule");
static constexpr auto name = const_name("types.CapsuleType");

private:
void *value = nullptr;
Expand Down Expand Up @@ -1000,7 +1000,7 @@ struct handle_type_name<type> {
};
template <>
struct handle_type_name<capsule> {
static constexpr auto name = const_name("capsule");
static constexpr auto name = const_name("types.CapsuleType");
};
template <>
struct handle_type_name<ellipsis> {
Expand Down
2 changes: 1 addition & 1 deletion tests/test_opaque_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_pointers(msg):
msg(excinfo.value)
== """
get_void_ptr_value(): incompatible function arguments. The following argument types are supported:
1. (arg0: capsule) -> int
1. (arg0: types.CapsuleType) -> int

Invoked with: [1, 2, 3]
"""
Expand Down
Loading