0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

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)
This commit is contained in:
Bram Moolenaar
2017-11-09 19:56:08 +01:00
parent 040c1feb21
commit de323093e1
5 changed files with 56 additions and 47 deletions

View File

@@ -5713,7 +5713,7 @@ run_eval(const char *cmd, typval_T *rettv
}
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, typval_T *tv, PyObject *lookup_dict)
Py_DECREF(num);
}
else if (obj == Py_None)
{
tv->v_type = VAR_SPECIAL;
tv->vval.v_number = VVAL_NONE;
}
else
{
PyErr_FORMAT(PyExc_TypeError,