Reply to message «[BUG] l: dictionary is locked before first line of a function is executed», sent 23:32:21 22 July 2011, Friday by ZyX:
Update: the following script is enough to reproduce this behavior
FAILED=0 ; for ((I=0 ; I<100 ; I++ )) ; do vim -u NONE -S <(<< EOF
python import vim
function Test()
python vim.eval('extend(l:, {"r": "abc"}')
return r
endfunction
try
call Test()
catch
call writefile([v:exception], 'exception')
endtry
qa!
EOF
) ; if test -e exception ; then (( FAILED++ )) ; cat exception ; \
rm exception ; fi ; done
Strange, but with this script running vim in a cycle I get FAILED=100, while I
don't get the same results if I launch vim manually and without a :qa!.
Original message:
> In my plugin I have a function
>
> function s:F.hg.annotate(repo, rev, file)
> execute s:_r.py.cmd 'aurum.annotate(vim.eval("a:repo.path"), '.
> \ 'vim.eval("a:rev"), '.
> \ 'vim.eval("a:file"))'
> return r
> endfunction
>
> . This function sometimes fail because aurum.annotate (
>
> def annotate(path, rev, filepath):
> ann=get_repo(path)[rev].filectx(filepath).annotate()
> vim.eval('extend(l:, {"r": ['+
> ", ".join(['"'+line[0].hex()+'"' for line
> in ann])+ ']})')
>
> ) fails with message `E741: Value is locked: extend() argument'. If I place
> a breakpoint on the first line of s:F.hg.annotate I see that islocked('l:')
> returns 1. Can anybody explain, why l: dictionary is locked before it has
> a chance to be accessed by any vimL code?
>
> Note that this does not happen on every launch of aurum, so it may be a
> race condition somewhere. This can be reproduces with
> cd /path/to/any/mercurial/repository &&
> VIMRUNTIME=$TESTROOT/rtp vim -u $TESTROOT/vimrc \
> --cmd 'let g:curtest="none"' \
> -c 'e aurum://annotate::tip:{anyfile}'
> where $TESTROOT is a path to directory where you unpacked attached archive
> and anyfile is a path to any existing file relative to
> /path/to/any/mercurial/repository. Vim must be compiled with python support
> and mercurial should be somewhere in sys.path.
>
> Aurum revision: https://bitbucket.org/ZyX_I/aurum/changeset/56446daa7342
> Vim version: 7.3.244 USE="X acl bash-completion cscope gpm nls perl python
> ruby vim-pager -debug -minimal"
signature.asc
Description: This is a digitally signed message part.
