Re: Preserving python between invocation of Python code.

42 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 10, 2012, 8:56:25 PM10/10/12
to Paul, vim...@googlegroups.com

Paul wrote:

> Vim python interface bug.
>
> Between any consecutive python code invocations, for example:
>
> :py def x(): print "hello World"
>
> and:
>
> :py x()
>
> State, specific to the (main) python thread is discarded. For example,
> any attempt to use sys.settrace() fails to provide the expected
> results.
>
> The attached patch fixes this for at least one case.
>
> FYI. I was trying to test vim-python extension code and obtain code coverage
> statistics using Ned Batchelder's covergae.py.
>
> I have just built this into my everyday Vim instance. I will update
> this post to indicate any problems or (lack thereof).

Does this also need to be changed in the Python 3 interface? Or was it
already working correctly there?


--
God made machine language; all the rest is the work of man.

/// Bram Moolenaar -- Br...@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 ///

Paul Ollis

unread,
Oct 15, 2012, 2:12:43 PM10/15/12
to vim...@googlegroups.com
On 11/10/12 01:56, Bram Moolenaar wrote:
>
> Paul wrote:
>
>> Vim python interface bug.
>>
<snip>
>
> Does this also need to be changed in the Python 3 interface? Or was it
> already working correctly there?
>
Having had a very quick look, I think the answer is yes.
I'll do some testing to confirm and submit a suitably updated patch.



Paul Ollis

unread,
Oct 19, 2012, 2:51:06 PM10/19/12
to vim...@googlegroups.com
...and the answer is yes. Updated patch attached

FYI. I have been using a patched version of Vim without any problems for
over a week without issues. My vim set up makes heavy use of Python.

vim-py-thread-state.patch
Reply all
Reply to author
Forward
0 new messages