diff src/if_py_both.h @ 12806:ef93c4415667 v8.0.1280

patch 8.0.1280: Python None cannot be converted to a Vim type commit https://github.com/vim/vim/commit/de323093e1be165a3eadd1ab3d02942358cd97bf Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 9 19:56:08 2017 +0100 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)
author Christian Brabandt <cb@256bit.org>
date Thu, 09 Nov 2017 20:00:05 +0100
parents 972ea22c946f
children 381e67ccf02c
line wrap: on
line diff
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -5713,7 +5713,7 @@ run_eval(const char *cmd, typval_T *rett
     }
     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 @@ ConvertFromPyObject(PyObject *obj, typva
 
 	Py_DECREF(num);
     }
+    else if (obj == Py_None)
+    {
+	tv->v_type = VAR_SPECIAL;
+	tv->vval.v_number = VVAL_NONE;
+    }
     else
     {
 	PyErr_FORMAT(PyExc_TypeError,