To: vim_dev@googlegroups.com Subject: Patch 8.1.1346 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.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) Files: src/if_py_both.h, src/testdir/test86.ok, src/testdir/test87.ok, src/testdir/test_python2.vim, src/testdir/test_python3.vim, src/testdir/test_pyx2.vim, src/testdir/test_pyx3.vim *** ../vim-8.1.1345/src/if_py_both.h 2019-05-09 15:12:45.172723940 +0200 --- src/if_py_both.h 2019-05-18 14:53:57.777848902 +0200 *************** *** 412,417 **** --- 412,419 ---- 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 *** ../vim-8.1.1345/src/testdir/test86.ok 2018-08-07 19:45:22.619218432 +0200 --- src/testdir/test86.ok 2019-05-18 14:42:55.261468186 +0200 *************** *** 91,97 **** 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: ! undefined_name: Vim(let):Trace vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] --- 91,97 ---- 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: ! undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] *** ../vim-8.1.1345/src/testdir/test87.ok 2018-08-07 19:45:22.623218411 +0200 --- src/testdir/test87.ok 2019-05-18 14:42:55.261468186 +0200 *************** *** 91,97 **** 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: ! undefined_name: Vim(let):Trace vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] --- 91,97 ---- 0.0 "\0": Vim(let):E859: {"\0": 1}: Vim(let):E859: ! undefined_name: Vim(let):NameE vim: Vim(let):E859: [1] [1, 10, 11, 10, 11, 10, 11, 10, 11, 10, 11, 10, 1] *** ../vim-8.1.1345/src/testdir/test_python2.vim 2019-03-30 12:33:07.845473937 +0100 --- src/testdir/test_python2.vim 2019-05-18 14:42:55.261468186 +0200 *************** *** 160,162 **** --- 160,170 ---- bwipe! endfunction + + func Test_Catch_Exception_Message() + try + py raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry + endfunc *** ../vim-8.1.1345/src/testdir/test_python3.vim 2019-03-30 12:33:07.845473937 +0100 --- src/testdir/test_python3.vim 2019-05-18 14:42:55.261468186 +0200 *************** *** 160,162 **** --- 160,170 ---- bwipe! endfunction + + func Test_Catch_Exception_Message() + try + py3 raise RuntimeError( 'TEST' ) + catch /.*/ + call assert_match( '^Vim(.*):RuntimeError: TEST$', v:exception ) + endtry + endfunc *** ../vim-8.1.1345/src/testdir/test_pyx2.vim 2017-01-28 15:36:57.000000000 +0100 --- src/testdir/test_pyx2.vim 2019-05-18 14:42:55.261468186 +0200 *************** *** 72,74 **** --- 72,82 ---- 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 *** ../vim-8.1.1345/src/testdir/test_pyx3.vim 2017-01-28 15:36:41.000000000 +0100 --- src/testdir/test_pyx3.vim 2019-05-18 14:42:55.261468186 +0200 *************** *** 72,74 **** --- 72,82 ---- 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 *** ../vim-8.1.1345/src/version.c 2019-05-18 13:41:19.061511348 +0200 --- src/version.c 2019-05-18 14:44:49.988846112 +0200 *************** *** 769,770 **** --- 769,772 ---- { /* Add new patch number below this line */ + /**/ + 1346, /**/ -- You can test a person's importance in the organization by asking how much RAM his computer has. Anybody who knows the answer to that question is not a decision-maker. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@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 ///