mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
type_caster_generic::load(): accept Py_None as input
This commit is contained in:
parent
cf2b87aa5e
commit
a3861b54c4
@ -102,7 +102,10 @@ public:
|
|||||||
PYBIND11_NOINLINE bool load(handle src, bool convert) {
|
PYBIND11_NOINLINE bool load(handle src, bool convert) {
|
||||||
if (!src || !typeinfo)
|
if (!src || !typeinfo)
|
||||||
return false;
|
return false;
|
||||||
if (PyType_IsSubtype(Py_TYPE(src.ptr()), typeinfo->type)) {
|
if (src.ptr() == Py_None) {
|
||||||
|
value = nullptr;
|
||||||
|
return true;
|
||||||
|
} else if (PyType_IsSubtype(Py_TYPE(src.ptr()), typeinfo->type)) {
|
||||||
value = ((instance<void> *) src.ptr())->value;
|
value = ((instance<void> *) src.ptr())->value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user