fixed docstring generation for void pointers

This commit is contained in:
Wenzel Jakob 2016-04-30 19:35:24 +02:00
parent fd7cf51a56
commit e8b9dd263c
4 changed files with 6 additions and 2 deletions

View File

@ -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")

View File

@ -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())

View File

@ -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;
};

View File

@ -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() +
_(">"));
};