mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
updated for version 7.4.084
Problem: Python: interrupt not being properly discarded. (Yggdroot Chen) Solution: Discard interrupt in VimTryEnd. (ZyX)
This commit is contained in:
@@ -558,7 +558,11 @@ VimTryEnd(void)
|
|||||||
/* Keyboard interrupt should be preferred over anything else */
|
/* Keyboard interrupt should be preferred over anything else */
|
||||||
if (got_int)
|
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);
|
PyErr_SetNone(PyExc_KeyboardInterrupt);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -567,7 +571,10 @@ VimTryEnd(void)
|
|||||||
/* Python exception is preferred over vim one; unlikely to occur though */
|
/* Python exception is preferred over vim one; unlikely to occur though */
|
||||||
else if (PyErr_Occurred())
|
else if (PyErr_Occurred())
|
||||||
{
|
{
|
||||||
did_throw = FALSE;
|
if (current_exception != NULL)
|
||||||
|
discard_current_exception();
|
||||||
|
else
|
||||||
|
need_rethrow = did_throw = FALSE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Finally transform VimL exception to python one */
|
/* Finally transform VimL exception to python one */
|
||||||
|
@@ -1281,6 +1281,37 @@ del Exe
|
|||||||
EOF
|
EOF
|
||||||
:delfunction Exe
|
: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
|
:" Cleanup
|
||||||
py << EOF
|
py << EOF
|
||||||
del cb
|
del cb
|
||||||
|
@@ -1198,3 +1198,7 @@ vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
|
|||||||
vim.eval("Exe('echoerr ''jkl''')"):error:('Vim(echoerr):jkl',)
|
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.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',)
|
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
|
||||||
|
|
||||||
|
@@ -1232,6 +1232,37 @@ del Exe
|
|||||||
EOF
|
EOF
|
||||||
:delfunction Exe
|
: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
|
:" Cleanup
|
||||||
py3 << EOF
|
py3 << EOF
|
||||||
del cb
|
del cb
|
||||||
|
@@ -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('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.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',))
|
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
|
||||||
|
|
||||||
|
@@ -738,6 +738,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
84,
|
||||||
/**/
|
/**/
|
||||||
83,
|
83,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user