diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 7ddd384d9..d1f6b2504 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -160,6 +160,8 @@ public: : typeinfo(get_type_info(type_info, false)) { } PYBIND11_NOINLINE bool load(handle src, bool convert) { + if (!src) + return false; return load(src, convert, Py_TYPE(src.ptr())); }