Commit 52f4c3ae by Wenzel Jakob

handle nullptr arguments with custom holder types (fixes #124)

parent c769fce2
......@@ -500,10 +500,12 @@ public:
using type_caster<type>::copy_constructor;
bool load(handle src, bool convert) {
if (!src || !typeinfo)
if (!src || !typeinfo) {
return false;
if (PyType_IsSubtype(Py_TYPE(src.ptr()), typeinfo->type)) {
} else if (src.ptr() == Py_None) {
value = nullptr;
return true;
} else if (PyType_IsSubtype(Py_TYPE(src.ptr()), typeinfo->type)) {
auto inst = (instance<type, holder_type> *) src.ptr();
value = inst->value;
holder = inst->holder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment