]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1646 v7.4.1646
authorBram Moolenaar <Bram@vim.org>
Thu, 24 Mar 2016 20:58:12 +0000 (21:58 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 24 Mar 2016 20:58:12 +0000 (21:58 +0100)
Problem:    Using Python vim.bindeval() on a partial doesn't work. (Nikolai
            Pavlov)
Solution:   Add VAR_PARTIAL support in Python.

src/if_py_both.h
src/testdir/test_partial.vim
src/version.c

index 3a80cb4effb51aab8be8d1f3aaf524277e3b2f64..ee882600fc64d2bc0e4e26d95b30e8ecfa6c0879 100644 (file)
@@ -6032,13 +6032,26 @@ ConvertToPyObject(typval_T *tv)
        case VAR_FUNC:
            return NEW_FUNCTION(tv->vval.v_string == NULL
                                          ? (char_u *)"" : tv->vval.v_string);
+       case VAR_PARTIAL:
+           return NEW_FUNCTION(tv->vval.v_partial == NULL
+                               ? (char_u *)"" : tv->vval.v_partial->pt_name);
        case VAR_UNKNOWN:
+       case VAR_CHANNEL:
+       case VAR_JOB:
            Py_INCREF(Py_None);
            return Py_None;
-       default:
+       case VAR_SPECIAL:
+           switch (tv->vval.v_number)
+           {
+               case VVAL_FALSE: return AlwaysFalse(NULL);
+               case VVAL_TRUE:  return AlwaysTrue(NULL);
+               case VVAL_NONE:
+               case VVAL_NULL:  return AlwaysNone(NULL);
+           }
            PyErr_SET_VIM(N_("internal error: invalid value type"));
            return NULL;
     }
+    return NULL;
 }
 
 typedef struct
index 1fe67eabcf1294f6b0ba7300c3fad315d1b0db13..08958de836da4af4063581dc2dd7d761215c8db0 100644 (file)
@@ -206,3 +206,17 @@ func Test_redefine_dict_func()
     call assert_true(v:errmsg, v:exception)
   endtry
 endfunc
+
+func Test_bind_in_python()
+  if has('python')
+    let g:d = {}
+    function g:d.test2()
+    endfunction
+    python import vim
+    try
+      call assert_equal(pyeval('vim.bindeval("g:d.test2")'), g:d.test2)
+    catch
+      call assert_true(v:false, v:exception)
+    endtry
+  endif
+endfunc
index dd9b5c2850b3d06eae06ee97df24386e5e1a232b..4ab8eed71fdaa7e36dfc68f04cf3f3db3f904f9f 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1646,
 /**/
     1645,
 /**/