Commit 9b880ba7 by Wenzel Jakob

keep_alive: don't fail when there is no patient

parent 7d0162a2
......@@ -982,6 +982,9 @@ PYBIND11_NOINLINE inline void keep_alive_impl(int Nurse, int Patient, handle arg
if (!nurse || !patient)
pybind11_fail("Could not activate keep_alive!");
if (patient.ptr() == Py_None)
return; /* Nothing to keep alive */
cpp_function disable_lifesupport(
[patient](handle weakref) { patient.dec_ref(); weakref.dec_ref(); });
......
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