patch 8.0.1280: Python None cannot be converted to a Vim type
Problem: Python None cannot be converted to a Vim type.
Solution: Convert it to v:none. (Ken Takata)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index e717646..1801967 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -5713,7 +5713,7 @@
}
else
{
- if (run_ret != Py_None && ConvertFromPyObject(run_ret, rettv) == -1)
+ if (ConvertFromPyObject(run_ret, rettv) == -1)
EMSG(_("E859: Failed to convert returned python object to vim value"));
Py_DECREF(run_ret);
}
@@ -6231,6 +6231,11 @@
Py_DECREF(num);
}
+ else if (obj == Py_None)
+ {
+ tv->v_type = VAR_SPECIAL;
+ tv->vval.v_number = VVAL_NONE;
+ }
else
{
PyErr_FORMAT(PyExc_TypeError,