diff options
author | Bram Moolenaar <Bram@vim.org> | 2012-10-05 21:30:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2012-10-05 21:30:07 +0200 |
commit | d1f13fd5978df5fd4b2e0fbc61e671edec958e15 (patch) | |
tree | cb72f7a3c0fac444ad160ea5b495e1d2faec87c1 | |
parent | 4ccb265bd41a2048edbe4a42b1d9ca92adcc9bb9 (diff) | |
download | vim-d1f13fd5978df5fd4b2e0fbc61e671edec958e15.zip |
updated for version 7.3.683
Problem: ":python" may crash when vimbindeval() returns None.
Solution: Check for v_string to be NULL. (Yukihiro Nakadaira)
-rw-r--r-- | src/if_py_both.h | 9 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 0a1ef1b9e..2398e812c 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -351,7 +351,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict) if (our_tv->v_type == VAR_STRING) { - result = Py_BuildValue("s", our_tv->vval.v_string); + result = Py_BuildValue("s", our_tv->vval.v_string == NULL + ? "" : (char *)our_tv->vval.v_string); } else if (our_tv->v_type == VAR_NUMBER) { @@ -2751,7 +2752,8 @@ ConvertToPyObject(typval_T *tv) switch (tv->v_type) { case VAR_STRING: - return PyBytes_FromString((char *) tv->vval.v_string); + return PyBytes_FromString(tv->vval.v_string == NULL + ? "" : (char *)tv->vval.v_string); case VAR_NUMBER: return PyLong_FromLong((long) tv->vval.v_number); #ifdef FEAT_FLOAT @@ -2763,7 +2765,8 @@ ConvertToPyObject(typval_T *tv) case VAR_DICT: return DictionaryNew(tv->vval.v_dict); case VAR_FUNC: - return FunctionNew(tv->vval.v_string); + return FunctionNew(tv->vval.v_string == NULL + ? (char_u *)"" : tv->vval.v_string); case VAR_UNKNOWN: Py_INCREF(Py_None); return Py_None; diff --git a/src/version.c b/src/version.c index 143657e34..62e0f4b1a 100644 --- a/src/version.c +++ b/src/version.c @@ -720,6 +720,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 683, +/**/ 682, /**/ 681, |