mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +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) {
|
||||
if (!src || !typeinfo)
|
||||
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;
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user