]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.683 v7.3.683
authorBram Moolenaar <Bram@vim.org>
Fri, 5 Oct 2012 19:30:07 +0000 (21:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 5 Oct 2012 19:30:07 +0000 (21:30 +0200)
Problem:    ":python" may crash when vimbindeval() returns None.
Solution:   Check for v_string to be NULL. (Yukihiro Nakadaira)

src/if_py_both.h
src/version.c

index 0a1ef1b9e6e51c8c6f638bc01916bc39a03a5412..2398e812c2ef4e086cc2569a95b6aa43c2b6f0bb 100644 (file)
@@ -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;
index 143657e3430dc6ea09658ae757cd7bf1481d599d..62e0f4b1a840ba2f50d187dea8c08c7f7aa787b2 100644 (file)
@@ -719,6 +719,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    683,
 /**/
     682,
 /**/