mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 13:15:12 +00:00
fixed docstring generation for void pointers
This commit is contained in:
parent
fd7cf51a56
commit
e8b9dd263c
@ -19,7 +19,7 @@ public:
|
||||
};
|
||||
|
||||
/* IMPORTANT: Disable internal pybind11 translation mechanisms for STL data structures */
|
||||
PYBIND11_MAKE_OPAQUE(StringList);
|
||||
PYBIND11_MAKE_OPAQUE(StringList);
|
||||
|
||||
void init_ex14(py::module &m) {
|
||||
py::class_<StringList>(m, "StringList")
|
||||
|
@ -8,6 +8,7 @@ from example import ClassWithSTLVecProperty
|
||||
from example import return_void_ptr, print_void_ptr
|
||||
from example import return_null_str, print_null_str
|
||||
from example import return_unique_ptr
|
||||
from example import Example1
|
||||
|
||||
#####
|
||||
|
||||
@ -32,6 +33,7 @@ print_opaque_list(cvp.stringList)
|
||||
#####
|
||||
|
||||
print_void_ptr(return_void_ptr())
|
||||
print_void_ptr(Example1()) # Should also work for other C++ types
|
||||
|
||||
print(return_null_str())
|
||||
print_null_str(return_null_str())
|
||||
|
@ -398,6 +398,7 @@ public:
|
||||
|
||||
template <typename T> using cast_op_type = void*&;
|
||||
operator void *&() { return value; }
|
||||
static PYBIND11_DESCR name() { return _("capsule"); }
|
||||
private:
|
||||
void *value = nullptr;
|
||||
};
|
||||
|
@ -17,6 +17,7 @@ NAMESPACE_BEGIN(detail)
|
||||
|
||||
template <typename Return, typename... Args> struct type_caster<std::function<Return(Args...)>> {
|
||||
typedef std::function<Return(Args...)> type;
|
||||
typedef typename std::conditional<std::is_same<Return, void>::value, void_type, Return>::type retval_type;
|
||||
public:
|
||||
bool load(handle src_, bool) {
|
||||
src_ = detail::get_function(src_);
|
||||
@ -39,7 +40,7 @@ public:
|
||||
|
||||
PYBIND11_TYPE_CASTER(type, _("function<") +
|
||||
type_caster<std::tuple<Args...>>::name() + _(" -> ") +
|
||||
type_caster<typename intrinsic_type<Return>::type>::name() +
|
||||
type_caster<retval_type>::name() +
|
||||
_(">"));
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user