patch 9.1.0848: if_lua: v:false/v:true are not evaluated to boolean Commit: https://github.com/vim/vim/commit/50732c7ba648f955ba027e6386745ea37acf007b Author: zeertzjq <zeert...@outlook.com> Date: Sat Nov 9 18:30:10 2024 +0100
patch 9.1.0848: if_lua: v:false/v:true are not evaluated to boolean Problem: if_lua: v:false/v:true are not evaluated to boolean Solution: Use lua_pushboolean() instead of lua_pushinteger(). (zeertzjq) fixes: #15994 closes: #11419 Signed-off-by: zeertzjq <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/if_lua.c b/src/if_lua.c index 4d19c3ef5..d01b9f96a 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -595,7 +595,7 @@ luaV_pushtypval(lua_State *L, typval_T *tv) case VAR_BOOL: case VAR_SPECIAL: if (tv->vval.v_number <= VVAL_TRUE) - lua_pushinteger(L, (int) tv->vval.v_number); + lua_pushboolean(L, (int) tv->vval.v_number); else lua_pushnil(L); break; diff --git a/src/testdir/test_lua.vim b/src/testdir/test_lua.vim index a99affc04..5225ce8f8 100644 --- a/src/testdir/test_lua.vim +++ b/src/testdir/test_lua.vim @@ -117,11 +117,11 @@ func Test_lua_eval() " lua.eval with a bool lua v = vim.eval('v:true') - call assert_equal('number', luaeval('vim.type(v)')) - call assert_equal(1, luaeval('v')) + call assert_equal('boolean', luaeval('vim.type(v)')) + call assert_equal(v:true, luaeval('v')) lua v = vim.eval('v:false') - call assert_equal('number', luaeval('vim.type(v)')) - call assert_equal(0, luaeval('v')) + call assert_equal('boolean', luaeval('vim.type(v)')) + call assert_equal(v:false, luaeval('v')) " lua.eval with a null lua v = vim.eval('v:null') diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 5e2b555be..20f9dc6c6 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -299,7 +299,7 @@ func Test_unicode() endfunc " Test vim.eval() with various types. -func Test_python3_vim_val() +func Test_python3_vim_eval() call assert_equal(" 8", execute('py3 print(vim.eval("3+5"))')) call assert_equal(" 3.140000", execute('py3 print(vim.eval("1.01+2.13"))')) call assert_equal(" 0.000000", execute('py3 print(vim.eval("0.0/(1.0/0.0)"))')) diff --git a/src/version.c b/src/version.c index fe1902e56..2839e8980 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 848, /**/ 847, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1t9pWB-009RqK-GI%40256bit.org.