From 9f08625d60b315b5f64c64073b811fd3936c6852 Mon Sep 17 00:00:00 2001 From: Tim Ohliger Date: Tue, 18 Mar 2025 19:29:57 +0100 Subject: [PATCH] Updated py::capsule type hint to use new types.CapsuleType (#5567) --- include/pybind11/cast.h | 4 ++-- tests/test_opaque_types.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 8d74ab742..a160dfad1 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -305,7 +305,7 @@ public: template 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; @@ -1281,7 +1281,7 @@ struct handle_type_name { }; template <> struct handle_type_name { - static constexpr auto name = const_name("capsule"); + static constexpr auto name = const_name("types.CapsuleType"); }; template <> struct handle_type_name { diff --git a/tests/test_opaque_types.py b/tests/test_opaque_types.py index 56c9b5db1..498b6e02b 100644 --- a/tests/test_opaque_types.py +++ b/tests/test_opaque_types.py @@ -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] """