mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-11 08:50:31 +00:00
Fix implicit conversion of accessors to types derived from py::object
Fixes #1069.
This commit is contained in:
@@ -431,8 +431,8 @@ class accessor : public object_api<accessor<Policy>> {
|
||||
|
||||
public:
|
||||
accessor(handle obj, key_type key) : obj(obj), key(std::move(key)) { }
|
||||
accessor(const accessor &a) = default;
|
||||
accessor(accessor &&a) = default;
|
||||
accessor(const accessor &) = default;
|
||||
accessor(accessor &&) = default;
|
||||
|
||||
// accessor overload required to override default assignment operator (templates are not allowed
|
||||
// to replace default compiler-generated assignments).
|
||||
@@ -743,7 +743,9 @@ NAMESPACE_END(detail)
|
||||
{ if (!m_ptr) throw error_already_set(); } \
|
||||
Name(object &&o) \
|
||||
: Parent(check_(o) ? o.release().ptr() : ConvertFun(o.ptr()), stolen_t{}) \
|
||||
{ if (!m_ptr) throw error_already_set(); }
|
||||
{ if (!m_ptr) throw error_already_set(); } \
|
||||
template <typename Policy_> \
|
||||
Name(const ::pybind11::detail::accessor<Policy_> &a) : Name(object(a)) { }
|
||||
|
||||
#define PYBIND11_OBJECT(Name, Parent, CheckFun) \
|
||||
PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \
|
||||
|
||||
Reference in New Issue
Block a user