Uh oh!
There was an error while loading. Please reload this page.
additional assert demonstrating that pybind::str can also by bytes in… - #2343
additional assert demonstrating that pybind::str can also by bytes in…#2343rwgk wants to merge 1 commit into
Conversation
…deed (proving isinstance<str> right)
Uh oh!
There was an error while loading. Please reload this page.
YannickJadoul
commented
Jul 30, 2020
Alright, this makes sense from the code's perspective, since both template <typename T, detail::enable_if_t<std::is_base_of<object, T>::value, int> = 0>
boolisinstance(handle obj) { returnT::check_(obj); }and #definePYBIND11_OBJECT_CVT(Name, Parent, CheckFun, ConvertFun) \
PYBIND11_OBJECT_COMMON(Name, Parent, CheckFun) \
/* This is deliberately not 'explicit' to allow implicit conversion from object: */ \
Name(const object &o) \
: Parent(check_(o) ? o.inc_ref().ptr() : ConvertFun(o.ptr()), stolen_t{}) \
{ if (!m_ptr) throwerror_already_set(); } \
Name(object &&o) \
: Parent(check_(o) ? o.release().ptr() : ConvertFun(o.ptr()), stolen_t{}) \
{ if (!m_ptr) throwerror_already_set(); } \
template <typename Policy_> \
Name(const ::pybind11::detail::accessor<Policy_> &a) : Name(object(a)) { }This seems wrong to me, though. Especially because there is a but |
YannickJadoul
commented
Jul 30, 2020
(I'm assuming this is a demonstrating PR, and not something you actually want to get merged, right?) |
rwgk
commented
Jul 30, 2020
rwgk
commented
Aug 11, 2020
PR #2366 just merged includes another way to expose that |
…deed (proving isinstance right)