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