To: vim_dev@googlegroups.com Subject: Patch 7.4.1646 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1646 Problem: Using Python vim.bindeval() on a partial doesn't work. (Nikolai Pavlov) Solution: Add VAR_PARTIAL support in Python. Files: src/if_py_both.h *** ../vim-7.4.1645/src/if_py_both.h 2016-03-19 22:11:47.436674835 +0100 --- src/if_py_both.h 2016-03-24 21:54:12.266629182 +0100 *************** *** 6032,6044 **** case VAR_FUNC: return NEW_FUNCTION(tv->vval.v_string == NULL ? (char_u *)"" : tv->vval.v_string); case VAR_UNKNOWN: Py_INCREF(Py_None); return Py_None; ! default: PyErr_SET_VIM(N_("internal error: invalid value type")); return NULL; } } typedef struct --- 6032,6057 ---- 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; ! 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 *** ../vim-7.4.1645/src/testdir/test_partial.vim 2016-03-24 21:41:47.206312503 +0100 --- src/testdir/test_partial.vim 2016-03-24 21:45:28.936030177 +0100 *************** *** 206,208 **** --- 206,222 ---- 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 *** ../vim-7.4.1645/src/version.c 2016-03-24 21:41:47.206312503 +0100 --- src/version.c 2016-03-24 21:55:21.753911050 +0100 *************** *** 750,751 **** --- 750,753 ---- { /* Add new patch number below this line */ + /**/ + 1646, /**/ -- Two percent of zero is almost nothing. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///