diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-11-09 19:56:08 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-11-09 19:56:08 +0100 |
commit | de323093e1be165a3eadd1ab3d02942358cd97bf (patch) | |
tree | 088f65bfbec9f716e6e9e46936b13110c6d100a3 /src/if_py_both.h | |
parent | 040c1feb212568cf04265e59b26182f8b76057aa (diff) | |
download | vim-de323093e1be165a3eadd1ab3d02942358cd97bf.zip |
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)
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r-- | src/if_py_both.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index e717646d0..180196726 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -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, |