1
0
forked from aniani/vim

updated for version 7.3.683

Problem:    ":python" may crash when vimbindeval() returns None.
Solution:   Check for v_string to be NULL. (Yukihiro Nakadaira)
This commit is contained in:
Bram Moolenaar
2012-10-05 21:30:07 +02:00
parent 4ccb265bd4
commit d1f13fd597
2 changed files with 8 additions and 3 deletions

View 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;

View File

@@ -719,6 +719,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
683,
/**/
682,
/**/