Blame SOURCES/7.4.084

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.084
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.084
22c937
Problem:    Python: interrupt not being properly discarded. (Yggdroot Chen)
22c937
Solution:   Discard interrupt in VimTryEnd. (ZyX)
22c937
Files:      src/if_py_both.h, src/testdir/test86.in, src/testdir/test86.ok,
22c937
            src/testdir/test87.in, src/testdir/test87.ok
22c937
22c937
22c937
*** ../vim-7.4.083/src/if_py_both.h	2013-11-04 00:34:47.000000000 +0100
22c937
--- src/if_py_both.h	2013-11-11 00:56:41.000000000 +0100
22c937
***************
22c937
*** 558,564 ****
22c937
      /* Keyboard interrupt should be preferred over anything else */
22c937
      if (got_int)
22c937
      {
22c937
! 	did_throw = got_int = FALSE;
22c937
  	PyErr_SetNone(PyExc_KeyboardInterrupt);
22c937
  	return -1;
22c937
      }
22c937
--- 558,568 ----
22c937
      /* Keyboard interrupt should be preferred over anything else */
22c937
      if (got_int)
22c937
      {
22c937
! 	if (current_exception != NULL)
22c937
! 	    discard_current_exception();
22c937
! 	else
22c937
! 	    need_rethrow = did_throw = FALSE;
22c937
! 	got_int = FALSE;
22c937
  	PyErr_SetNone(PyExc_KeyboardInterrupt);
22c937
  	return -1;
22c937
      }
22c937
***************
22c937
*** 567,573 ****
22c937
      /* Python exception is preferred over vim one; unlikely to occur though */
22c937
      else if (PyErr_Occurred())
22c937
      {
22c937
! 	did_throw = FALSE;
22c937
  	return -1;
22c937
      }
22c937
      /* Finally transform VimL exception to python one */
22c937
--- 571,580 ----
22c937
      /* Python exception is preferred over vim one; unlikely to occur though */
22c937
      else if (PyErr_Occurred())
22c937
      {
22c937
! 	if (current_exception != NULL)
22c937
! 	    discard_current_exception();
22c937
! 	else
22c937
! 	    need_rethrow = did_throw = FALSE;
22c937
  	return -1;
22c937
      }
22c937
      /* Finally transform VimL exception to python one */
22c937
*** ../vim-7.4.083/src/testdir/test86.in	2013-11-04 00:34:47.000000000 +0100
22c937
--- src/testdir/test86.in	2013-11-11 00:56:11.000000000 +0100
22c937
***************
22c937
*** 1281,1286 ****
22c937
--- 1281,1317 ----
22c937
  EOF
22c937
  :delfunction Exe
22c937
  :"
22c937
+ :" Regression: interrupting vim.command propagates to next vim.command
22c937
+ py << EOF
22c937
+ def test_keyboard_interrupt():
22c937
+     try:
22c937
+         vim.command('while 1 | endwhile')
22c937
+     except KeyboardInterrupt:
22c937
+         cb.append('Caught KeyboardInterrupt')
22c937
+     except Exception:
22c937
+         cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info))
22c937
+     else:
22c937
+         cb.append('!!!!!!!! No exception')
22c937
+     try:
22c937
+         vim.command('$ put =\'Running :put\'')
22c937
+     except KeyboardInterrupt:
22c937
+         cb.append('!!!!!!!! Caught KeyboardInterrupt')
22c937
+     except Exception:
22c937
+         cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info))
22c937
+     else:
22c937
+         cb.append('No exception')
22c937
+ EOF
22c937
+ :debuggreedy
22c937
+ :call inputsave()
22c937
+ :call feedkeys("s\ns\ns\ns\nq\n")
22c937
+ :redir => output
22c937
+ :debug silent! py test_keyboard_interrupt()
22c937
+ :redir END
22c937
+ :0 debuggreedy
22c937
+ :silent $put =output
22c937
+ :unlet output
22c937
+ :py del test_keyboard_interrupt
22c937
+ :"
22c937
  :" Cleanup
22c937
  py << EOF
22c937
  del cb
22c937
*** ../vim-7.4.083/src/testdir/test86.ok	2013-11-04 00:34:47.000000000 +0100
22c937
--- src/testdir/test86.ok	2013-11-11 00:56:11.000000000 +0100
22c937
***************
22c937
*** 1198,1200 ****
22c937
--- 1198,1204 ----
22c937
  vim.eval("Exe('echoerr ''jkl''')"):error:('Vim(echoerr):jkl',)
22c937
  vim.eval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
22c937
  vim.bindeval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
22c937
+ Caught KeyboardInterrupt
22c937
+ Running :put
22c937
+ No exception
22c937
+ 
22c937
*** ../vim-7.4.083/src/testdir/test87.in	2013-11-04 00:34:47.000000000 +0100
22c937
--- src/testdir/test87.in	2013-11-11 00:56:11.000000000 +0100
22c937
***************
22c937
*** 1232,1237 ****
22c937
--- 1232,1268 ----
22c937
  EOF
22c937
  :delfunction Exe
22c937
  :"
22c937
+ :" Regression: interrupting vim.command propagates to next vim.command
22c937
+ py3 << EOF
22c937
+ def test_keyboard_interrupt():
22c937
+     try:
22c937
+         vim.command('while 1 | endwhile')
22c937
+     except KeyboardInterrupt:
22c937
+         cb.append('Caught KeyboardInterrupt')
22c937
+     except Exception as e:
22c937
+         cb.append('!!!!!!!! Caught exception: ' + repr(e))
22c937
+     else:
22c937
+         cb.append('!!!!!!!! No exception')
22c937
+     try:
22c937
+         vim.command('$ put =\'Running :put\'')
22c937
+     except KeyboardInterrupt:
22c937
+         cb.append('!!!!!!!! Caught KeyboardInterrupt')
22c937
+     except Exception as e:
22c937
+         cb.append('!!!!!!!! Caught exception: ' + repr(e))
22c937
+     else:
22c937
+         cb.append('No exception')
22c937
+ EOF
22c937
+ :debuggreedy
22c937
+ :call inputsave()
22c937
+ :call feedkeys("s\ns\ns\ns\nq\n")
22c937
+ :redir => output
22c937
+ :debug silent! py3 test_keyboard_interrupt()
22c937
+ :redir END
22c937
+ :0 debuggreedy
22c937
+ :silent $put =output
22c937
+ :unlet output
22c937
+ :py3 del test_keyboard_interrupt
22c937
+ :"
22c937
  :" Cleanup
22c937
  py3 << EOF
22c937
  del cb
22c937
*** ../vim-7.4.083/src/testdir/test87.ok	2013-11-04 00:34:47.000000000 +0100
22c937
--- src/testdir/test87.ok	2013-11-11 00:56:11.000000000 +0100
22c937
***************
22c937
*** 1187,1189 ****
22c937
--- 1187,1193 ----
22c937
  vim.eval("Exe('echoerr ''jkl''')"):(<class 'vim.error'>, error('Vim(echoerr):jkl',))
22c937
  vim.eval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
22c937
  vim.bindeval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
22c937
+ Caught KeyboardInterrupt
22c937
+ Running :put
22c937
+ No exception
22c937
+ 
22c937
*** ../vim-7.4.083/src/version.c	2013-11-09 05:30:18.000000000 +0100
22c937
--- src/version.c	2013-11-11 00:55:23.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     84,
22c937
  /**/
22c937
22c937
-- 
22c937
Computers make very fast, very accurate, mistakes.
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///