]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.084 v7.4.084
authorBram Moolenaar <Bram@vim.org>
Mon, 11 Nov 2013 00:05:48 +0000 (01:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 11 Nov 2013 00:05:48 +0000 (01:05 +0100)
Problem:    Python: interrupt not being properly discarded. (Yggdroot Chen)
Solution:   Discard interrupt in VimTryEnd. (ZyX)

src/if_py_both.h
src/testdir/test86.in
src/testdir/test86.ok
src/testdir/test87.in
src/testdir/test87.ok
src/version.c

index 748577981c71d75e48ec2348e581edb7d482f8c8..e6db4a3d0354d6fb7f9aec1f14a8c16104fecf0f 100644 (file)
@@ -558,7 +558,11 @@ VimTryEnd(void)
     /* Keyboard interrupt should be preferred over anything else */
     if (got_int)
     {
-       did_throw = got_int = FALSE;
+       if (current_exception != NULL)
+           discard_current_exception();
+       else
+           need_rethrow = did_throw = FALSE;
+       got_int = FALSE;
        PyErr_SetNone(PyExc_KeyboardInterrupt);
        return -1;
     }
@@ -567,7 +571,10 @@ VimTryEnd(void)
     /* Python exception is preferred over vim one; unlikely to occur though */
     else if (PyErr_Occurred())
     {
-       did_throw = FALSE;
+       if (current_exception != NULL)
+           discard_current_exception();
+       else
+           need_rethrow = did_throw = FALSE;
        return -1;
     }
     /* Finally transform VimL exception to python one */
index 48fa4e5a1dd26dae32ef0f1dafebd0a5e3467807..91f771dcf02ce4ed5b2e898a69a7bc6f5c8d79be 100644 (file)
@@ -1281,6 +1281,37 @@ del Exe
 EOF
 :delfunction Exe
 :"
+:" Regression: interrupting vim.command propagates to next vim.command
+py << EOF
+def test_keyboard_interrupt():
+    try:
+        vim.command('while 1 | endwhile')
+    except KeyboardInterrupt:
+        cb.append('Caught KeyboardInterrupt')
+    except Exception:
+        cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info))
+    else:
+        cb.append('!!!!!!!! No exception')
+    try:
+        vim.command('$ put =\'Running :put\'')
+    except KeyboardInterrupt:
+        cb.append('!!!!!!!! Caught KeyboardInterrupt')
+    except Exception:
+        cb.append('!!!!!!!! Caught exception: ' + repr(sys.exc_info))
+    else:
+        cb.append('No exception')
+EOF
+:debuggreedy
+:call inputsave()
+:call feedkeys("s\ns\ns\ns\nq\n")
+:redir => output
+:debug silent! py test_keyboard_interrupt()
+:redir END
+:0 debuggreedy
+:silent $put =output
+:unlet output
+:py del test_keyboard_interrupt
+:"
 :" Cleanup
 py << EOF
 del cb
index 69c98d02d3a6375f5016521459c97226dd6ac094..2d5b1619e9d5c4588146f7be532c340fdf0623fe 100644 (file)
@@ -1198,3 +1198,7 @@ vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
 vim.eval("Exe('echoerr ''jkl''')"):error:('Vim(echoerr):jkl',)
 vim.eval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
 vim.bindeval("Exe('xxx_non_existent_command_xxx')"):error:('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',)
+Caught KeyboardInterrupt
+Running :put
+No exception
+
index 54cd97748fe3a2079bdbf66b23ccb5cdb9b88ca8..899e4f33893ad20673a73972f67b73367f11345c 100644 (file)
@@ -1232,6 +1232,37 @@ del Exe
 EOF
 :delfunction Exe
 :"
+:" Regression: interrupting vim.command propagates to next vim.command
+py3 << EOF
+def test_keyboard_interrupt():
+    try:
+        vim.command('while 1 | endwhile')
+    except KeyboardInterrupt:
+        cb.append('Caught KeyboardInterrupt')
+    except Exception as e:
+        cb.append('!!!!!!!! Caught exception: ' + repr(e))
+    else:
+        cb.append('!!!!!!!! No exception')
+    try:
+        vim.command('$ put =\'Running :put\'')
+    except KeyboardInterrupt:
+        cb.append('!!!!!!!! Caught KeyboardInterrupt')
+    except Exception as e:
+        cb.append('!!!!!!!! Caught exception: ' + repr(e))
+    else:
+        cb.append('No exception')
+EOF
+:debuggreedy
+:call inputsave()
+:call feedkeys("s\ns\ns\ns\nq\n")
+:redir => output
+:debug silent! py3 test_keyboard_interrupt()
+:redir END
+:0 debuggreedy
+:silent $put =output
+:unlet output
+:py3 del test_keyboard_interrupt
+:"
 :" Cleanup
 py3 << EOF
 del cb
index eed179c5a9e21b956ed635819e32cf89ec42029e..970818c9972e13a3ff6139f9b5c9340a3b739ef5 100644 (file)
@@ -1187,3 +1187,7 @@ vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))
 vim.eval("Exe('echoerr ''jkl''')"):(<class 'vim.error'>, error('Vim(echoerr):jkl',))
 vim.eval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
 vim.bindeval("Exe('xxx_non_existent_command_xxx')"):(<class 'vim.error'>, error('Vim:E492: Not an editor command: xxx_non_existent_command_xxx',))
+Caught KeyboardInterrupt
+Running :put
+No exception
+
index ce5d25053db4985113633186d029dce758a86ba3..f9bb7dd9f3f5693e1a9ee16640df162c8d82884c 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    84,
 /**/
     83,
 /**/