1
0
forked from aniani/vim

patch 9.1.0844: if_python: no way to pass local vars to python

Problem:  if_python: no way to pass local vars to python
Solution: Add locals argument to py3eval(), pyeval() and pyxeval()
          (Ben Jackson)

fixes: #8573
closes: #10594

Signed-off-by: Ben Jackson <puremourning@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ben Jackson
2024-11-06 21:50:05 +01:00
committed by Christian Brabandt
parent fd1a838d36
commit ea19e7856b
16 changed files with 291 additions and 30 deletions

View File

@@ -0,0 +1,17 @@
source check.vim
import './vim9.vim' as v9
CheckFeature python3
def Test_python3_py3eval_locals()
var lines =<< trim EOF
var s = 'string'
var d = {'s': s}
assert_equal('string', py3eval('s', {'s': s}))
py3eval('d.update({"s": "new"})', {'d': d})
assert_equal('new', d['s'])
EOF
v9.CheckDefAndScriptSuccess(lines)
enddef
" vim: shiftwidth=2 sts=2 expandtab