diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-18 15:02:25 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-18 15:02:25 +0200 |
commit | 7f3a28490abb7c495239fc438825e3d1aaafa76d (patch) | |
tree | 1a9c55ef4716279a37b8c837e64af844bd560b78 | |
parent | 6349e9411fd17f80c7aff9c678a8800647d34cfa (diff) | |
download | vim-git-7f3a28490abb7c495239fc438825e3d1aaafa76d.tar.gz |
patch 8.1.1346: error for Python exception does not show useful infov8.1.1346
Problem: Error for Python exception does not show useful info.
Solution: Show the last line instead of the first one. (Ben Jackson,
closes #4381)
-rw-r--r-- | src/if_py_both.h | 2 | ||||
-rw-r--r-- | src/testdir/test86.ok | 2 | ||||
-rw-r--r-- | src/testdir/test87.ok | 2 | ||||
-rw-r--r-- | src/testdir/test_python2.vim | 8 | ||||
-rw-r--r-- | src/testdir/test_python3.vim | 8 | ||||
-rw-r--r-- | src/testdir/test_pyx2.vim | 8 | ||||
-rw-r--r-- | src/testdir/test_pyx3.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
8 files changed, 38 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h index 4e1a42a3c..cc0450c13 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -412,6 +412,8 @@ write_output(OutputObject *self, PyObject *string) Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); + if (error) + emsg_severe = TRUE; writer((writefn)(error ? emsg : msg), (char_u *)str, len); Python_Release_Vim(); Py_END_ALLOW_THREADS diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 24d3fd4bd..6ad02e372 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -91,7 +91,7 @@ pyeval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: -undefined_name: Vim(let):Trace +undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index a7d4f6426..7ddea8f26 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -91,7 +91,7 @@ py3eval("None") = v:none 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: -undefined_name: Vim(let):Trace +undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] diff --git a/src/testdir/test_python2.vim b/src/testdir/test_python2.vim index 632f7a872..5703231ed 100644 --- a/src/testdir/test_python2.vim +++ b/src/testdir/test_python2.vim @@ -160,3 +160,11 @@ func Test_Write_To_Current_Buffer_Fixes_Cursor_Str() bwipe! endfunction + +func Test_Catch_Exception_Message() + try + py raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_python3.vim b/src/testdir/test_python3.vim index 514661ee2..aacc5a575 100644 --- a/src/testdir/test_python3.vim +++ b/src/testdir/test_python3.vim @@ -160,3 +160,11 @@ func Test_Write_To_Current_Buffer_Fixes_Cursor_Str() bwipe! endfunction + +func Test_Catch_Exception_Message() + try + py3 raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_pyx2.vim b/src/testdir/test_pyx2.vim index 50e57c3bf..baaf7fa30 100644 --- a/src/testdir/test_pyx2.vim +++ b/src/testdir/test_pyx2.vim @@ -72,3 +72,11 @@ func Test_pyxfile() call assert_match(s:py3pattern, split(var)[0]) endif endfunc + +func Test_Catch_Exception_Message() + try + pyx raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/testdir/test_pyx3.vim b/src/testdir/test_pyx3.vim index 64546b468..4b6057a8d 100644 --- a/src/testdir/test_pyx3.vim +++ b/src/testdir/test_pyx3.vim @@ -72,3 +72,11 @@ func Test_pyxfile() call assert_match(s:py2pattern, split(var)[0]) endif endfunc + +func Test_Catch_Exception_Message() + try + pyx raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry +endfunc diff --git a/src/version.c b/src/version.c index 519427655..fc1a5d56f 100644 --- a/src/version.c +++ b/src/version.c @@ -768,6 +768,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1346, +/**/ 1345, /**/ 1344, |