mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-02-06 23:56:59 +08: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…
x
Reference in New Issue
Block a user