|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.107
|
|
|
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.107
|
|
|
22c937 |
Problem: Python: When vim.eval() encounters a Vim error, a try/catch in the
|
|
|
22c937 |
Python code doesn't catch it. (Yggdroot Chen)
|
|
|
22c937 |
Solution: Throw exceptions on errors in vim.eval(). (ZyX)
|
|
|
22c937 |
Files: src/ex_eval.c, src/if_py_both.h, src/proto/ex_eval.pro,
|
|
|
22c937 |
src/testdir/test86.in, src/testdir/test86.ok,
|
|
|
22c937 |
src/testdir/test87.in, src/testdir/test87.ok
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.106/src/ex_eval.c 2013-06-08 15:50:28.000000000 +0200
|
|
|
22c937 |
--- src/ex_eval.c 2013-11-28 16:59:09.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 321,326 ****
|
|
|
22c937 |
--- 321,337 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
+ * Free global "*msg_list" and the messages it contains, then set "*msg_list"
|
|
|
22c937 |
+ * to NULL.
|
|
|
22c937 |
+ */
|
|
|
22c937 |
+ void
|
|
|
22c937 |
+ free_global_msglist()
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ free_msglist(*msg_list);
|
|
|
22c937 |
+ *msg_list = NULL;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /*
|
|
|
22c937 |
* Throw the message specified in the call to cause_errthrow() above as an
|
|
|
22c937 |
* error exception. If cstack is NULL, postpone the throw until do_cmdline()
|
|
|
22c937 |
* has returned (see do_one_cmd()).
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 410,475 ****
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
-
|
|
|
22c937 |
/*
|
|
|
22c937 |
! * Throw a new exception. Return FAIL when out of memory or it was tried to
|
|
|
22c937 |
! * throw an illegal user exception. "value" is the exception string for a user
|
|
|
22c937 |
! * or interrupt exception, or points to a message list in case of an error
|
|
|
22c937 |
! * exception.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! static int
|
|
|
22c937 |
! throw_exception(value, type, cmdname)
|
|
|
22c937 |
void *value;
|
|
|
22c937 |
int type;
|
|
|
22c937 |
char_u *cmdname;
|
|
|
22c937 |
{
|
|
|
22c937 |
! except_T *excp;
|
|
|
22c937 |
! char_u *p, *mesg, *val;
|
|
|
22c937 |
int cmdlen;
|
|
|
22c937 |
!
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * Disallow faking Interrupt or error exceptions as user exceptions. They
|
|
|
22c937 |
! * would be treated differently from real interrupt or error exceptions when
|
|
|
22c937 |
! * no active try block is found, see do_cmdline().
|
|
|
22c937 |
! */
|
|
|
22c937 |
! if (type == ET_USER)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if (STRNCMP((char_u *)value, "Vim", 3) == 0 &&
|
|
|
22c937 |
! (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':' ||
|
|
|
22c937 |
! ((char_u *)value)[3] == '('))
|
|
|
22c937 |
! {
|
|
|
22c937 |
! EMSG(_("E608: Cannot :throw exceptions with 'Vim' prefix"));
|
|
|
22c937 |
! goto fail;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! }
|
|
|
22c937 |
!
|
|
|
22c937 |
! excp = (except_T *)alloc((unsigned)sizeof(except_T));
|
|
|
22c937 |
! if (excp == NULL)
|
|
|
22c937 |
! goto nomem;
|
|
|
22c937 |
|
|
|
22c937 |
if (type == ET_ERROR)
|
|
|
22c937 |
{
|
|
|
22c937 |
! /* Store the original message and prefix the exception value with
|
|
|
22c937 |
! * "Vim:" or, if a command name is given, "Vim(cmdname):". */
|
|
|
22c937 |
! excp->messages = (struct msglist *)value;
|
|
|
22c937 |
! mesg = excp->messages->throw_msg;
|
|
|
22c937 |
if (cmdname != NULL && *cmdname != NUL)
|
|
|
22c937 |
{
|
|
|
22c937 |
cmdlen = (int)STRLEN(cmdname);
|
|
|
22c937 |
! excp->value = vim_strnsave((char_u *)"Vim(",
|
|
|
22c937 |
4 + cmdlen + 2 + (int)STRLEN(mesg));
|
|
|
22c937 |
! if (excp->value == NULL)
|
|
|
22c937 |
! goto nomem;
|
|
|
22c937 |
! STRCPY(&excp->value[4], cmdname);
|
|
|
22c937 |
! STRCPY(&excp->value[4 + cmdlen], "):");
|
|
|
22c937 |
! val = excp->value + 4 + cmdlen + 2;
|
|
|
22c937 |
}
|
|
|
22c937 |
else
|
|
|
22c937 |
{
|
|
|
22c937 |
! excp->value = vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg));
|
|
|
22c937 |
! if (excp->value == NULL)
|
|
|
22c937 |
! goto nomem;
|
|
|
22c937 |
! val = excp->value + 4;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* msg_add_fname may have been used to prefix the message with a file
|
|
|
22c937 |
--- 421,461 ----
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
! * Get an exception message that is to be stored in current_exception->value.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! char_u *
|
|
|
22c937 |
! get_exception_string(value, type, cmdname, should_free)
|
|
|
22c937 |
void *value;
|
|
|
22c937 |
int type;
|
|
|
22c937 |
char_u *cmdname;
|
|
|
22c937 |
+ int *should_free;
|
|
|
22c937 |
{
|
|
|
22c937 |
! char_u *ret, *mesg;
|
|
|
22c937 |
int cmdlen;
|
|
|
22c937 |
! char_u *p, *val;
|
|
|
22c937 |
|
|
|
22c937 |
if (type == ET_ERROR)
|
|
|
22c937 |
{
|
|
|
22c937 |
! *should_free = FALSE;
|
|
|
22c937 |
! mesg = ((struct msglist *)value)->throw_msg;
|
|
|
22c937 |
if (cmdname != NULL && *cmdname != NUL)
|
|
|
22c937 |
{
|
|
|
22c937 |
cmdlen = (int)STRLEN(cmdname);
|
|
|
22c937 |
! ret = vim_strnsave((char_u *)"Vim(",
|
|
|
22c937 |
4 + cmdlen + 2 + (int)STRLEN(mesg));
|
|
|
22c937 |
! if (ret == NULL)
|
|
|
22c937 |
! return ret;
|
|
|
22c937 |
! STRCPY(&ret[4], cmdname);
|
|
|
22c937 |
! STRCPY(&ret[4 + cmdlen], "):");
|
|
|
22c937 |
! val = ret + 4 + cmdlen + 2;
|
|
|
22c937 |
}
|
|
|
22c937 |
else
|
|
|
22c937 |
{
|
|
|
22c937 |
! ret = vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg));
|
|
|
22c937 |
! if (ret == NULL)
|
|
|
22c937 |
! return ret;
|
|
|
22c937 |
! val = ret + 4;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/* msg_add_fname may have been used to prefix the message with a file
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 506,519 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
else
|
|
|
22c937 |
! excp->value = value;
|
|
|
22c937 |
|
|
|
22c937 |
excp->type = type;
|
|
|
22c937 |
excp->throw_name = vim_strsave(sourcing_name == NULL
|
|
|
22c937 |
? (char_u *)"" : sourcing_name);
|
|
|
22c937 |
if (excp->throw_name == NULL)
|
|
|
22c937 |
{
|
|
|
22c937 |
! if (type == ET_ERROR)
|
|
|
22c937 |
vim_free(excp->value);
|
|
|
22c937 |
goto nomem;
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 492,556 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
else
|
|
|
22c937 |
! {
|
|
|
22c937 |
! *should_free = FALSE;
|
|
|
22c937 |
! ret = (char_u *) value;
|
|
|
22c937 |
! }
|
|
|
22c937 |
!
|
|
|
22c937 |
! return ret;
|
|
|
22c937 |
! }
|
|
|
22c937 |
!
|
|
|
22c937 |
!
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * Throw a new exception. Return FAIL when out of memory or it was tried to
|
|
|
22c937 |
! * throw an illegal user exception. "value" is the exception string for a
|
|
|
22c937 |
! * user or interrupt exception, or points to a message list in case of an
|
|
|
22c937 |
! * error exception.
|
|
|
22c937 |
! */
|
|
|
22c937 |
! static int
|
|
|
22c937 |
! throw_exception(value, type, cmdname)
|
|
|
22c937 |
! void *value;
|
|
|
22c937 |
! int type;
|
|
|
22c937 |
! char_u *cmdname;
|
|
|
22c937 |
! {
|
|
|
22c937 |
! except_T *excp;
|
|
|
22c937 |
! int should_free;
|
|
|
22c937 |
!
|
|
|
22c937 |
! /*
|
|
|
22c937 |
! * Disallow faking Interrupt or error exceptions as user exceptions. They
|
|
|
22c937 |
! * would be treated differently from real interrupt or error exceptions
|
|
|
22c937 |
! * when no active try block is found, see do_cmdline().
|
|
|
22c937 |
! */
|
|
|
22c937 |
! if (type == ET_USER)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! if (STRNCMP((char_u *)value, "Vim", 3) == 0
|
|
|
22c937 |
! && (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':'
|
|
|
22c937 |
! || ((char_u *)value)[3] == '('))
|
|
|
22c937 |
! {
|
|
|
22c937 |
! EMSG(_("E608: Cannot :throw exceptions with 'Vim' prefix"));
|
|
|
22c937 |
! goto fail;
|
|
|
22c937 |
! }
|
|
|
22c937 |
! }
|
|
|
22c937 |
!
|
|
|
22c937 |
! excp = (except_T *)alloc((unsigned)sizeof(except_T));
|
|
|
22c937 |
! if (excp == NULL)
|
|
|
22c937 |
! goto nomem;
|
|
|
22c937 |
!
|
|
|
22c937 |
! if (type == ET_ERROR)
|
|
|
22c937 |
! /* Store the original message and prefix the exception value with
|
|
|
22c937 |
! * "Vim:" or, if a command name is given, "Vim(cmdname):". */
|
|
|
22c937 |
! excp->messages = (struct msglist *)value;
|
|
|
22c937 |
!
|
|
|
22c937 |
! excp->value = get_exception_string(value, type, cmdname, &should_free);
|
|
|
22c937 |
! if (excp->value == NULL && should_free)
|
|
|
22c937 |
! goto nomem;
|
|
|
22c937 |
|
|
|
22c937 |
excp->type = type;
|
|
|
22c937 |
excp->throw_name = vim_strsave(sourcing_name == NULL
|
|
|
22c937 |
? (char_u *)"" : sourcing_name);
|
|
|
22c937 |
if (excp->throw_name == NULL)
|
|
|
22c937 |
{
|
|
|
22c937 |
! if (should_free)
|
|
|
22c937 |
vim_free(excp->value);
|
|
|
22c937 |
goto nomem;
|
|
|
22c937 |
}
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2033,2042 ****
|
|
|
22c937 |
/* If an error was about to be converted to an exception when
|
|
|
22c937 |
* enter_cleanup() was called, free the message list. */
|
|
|
22c937 |
if (msg_list != NULL)
|
|
|
22c937 |
! {
|
|
|
22c937 |
! free_msglist(*msg_list);
|
|
|
22c937 |
! *msg_list = NULL;
|
|
|
22c937 |
! }
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
--- 2070,2076 ----
|
|
|
22c937 |
/* If an error was about to be converted to an exception when
|
|
|
22c937 |
* enter_cleanup() was called, free the message list. */
|
|
|
22c937 |
if (msg_list != NULL)
|
|
|
22c937 |
! free_global_msglist();
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
*** ../vim-7.4.106/src/if_py_both.h 2013-11-11 01:05:43.000000000 +0100
|
|
|
22c937 |
--- src/if_py_both.h 2013-11-28 17:00:22.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 566,571 ****
|
|
|
22c937 |
--- 566,593 ----
|
|
|
22c937 |
PyErr_SetNone(PyExc_KeyboardInterrupt);
|
|
|
22c937 |
return -1;
|
|
|
22c937 |
}
|
|
|
22c937 |
+ else if (msg_list != NULL && *msg_list != NULL)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ int should_free;
|
|
|
22c937 |
+ char_u *msg;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ msg = get_exception_string(*msg_list, ET_ERROR, NULL, &should_free);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (msg == NULL)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ PyErr_NoMemory();
|
|
|
22c937 |
+ return -1;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ PyErr_SetVim((char *) msg);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ free_global_msglist();
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (should_free)
|
|
|
22c937 |
+ vim_free(msg);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ return -1;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
else if (!did_throw)
|
|
|
22c937 |
return (PyErr_Occurred() ? -1 : 0);
|
|
|
22c937 |
/* Python exception is preferred over vim one; unlikely to occur though */
|
|
|
22c937 |
*** ../vim-7.4.106/src/proto/ex_eval.pro 2013-08-10 13:37:10.000000000 +0200
|
|
|
22c937 |
--- src/proto/ex_eval.pro 2013-11-28 16:56:33.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 4,11 ****
|
|
|
22c937 |
--- 4,13 ----
|
|
|
22c937 |
int should_abort __ARGS((int retcode));
|
|
|
22c937 |
int aborted_in_try __ARGS((void));
|
|
|
22c937 |
int cause_errthrow __ARGS((char_u *mesg, int severe, int *ignore));
|
|
|
22c937 |
+ void free_global_msglist __ARGS((void));
|
|
|
22c937 |
void do_errthrow __ARGS((struct condstack *cstack, char_u *cmdname));
|
|
|
22c937 |
int do_intthrow __ARGS((struct condstack *cstack));
|
|
|
22c937 |
+ char_u *get_exception_string __ARGS((void *value, int type, char_u *cmdname, int *should_free));
|
|
|
22c937 |
void discard_current_exception __ARGS((void));
|
|
|
22c937 |
void report_make_pending __ARGS((int pending, void *value));
|
|
|
22c937 |
void report_resume_pending __ARGS((int pending, void *value));
|
|
|
22c937 |
*** ../vim-7.4.106/src/testdir/test86.in 2013-11-11 01:05:43.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test86.in 2013-11-28 16:41:01.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 179,184 ****
|
|
|
22c937 |
--- 179,210 ----
|
|
|
22c937 |
:unlockvar! l
|
|
|
22c937 |
:"
|
|
|
22c937 |
:" Function calls
|
|
|
22c937 |
+ py << EOF
|
|
|
22c937 |
+ import sys
|
|
|
22c937 |
+ def ee(expr, g=globals(), l=locals()):
|
|
|
22c937 |
+ try:
|
|
|
22c937 |
+ exec(expr, g, l)
|
|
|
22c937 |
+ except:
|
|
|
22c937 |
+ ei = sys.exc_info()
|
|
|
22c937 |
+ msg = sys.exc_info()[0].__name__ + ':' + repr(sys.exc_info()[1].args)
|
|
|
22c937 |
+ msg = msg.replace('TypeError:(\'argument 1 ', 'TypeError:(\'')
|
|
|
22c937 |
+ if expr.find('None') > -1:
|
|
|
22c937 |
+ msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
|
|
22c937 |
+ 'TypeError:("\'NoneType\' object is not iterable",)')
|
|
|
22c937 |
+ if expr.find('FailingNumber') > -1:
|
|
|
22c937 |
+ msg = msg.replace(', not \'FailingNumber\'', '').replace('"', '\'')
|
|
|
22c937 |
+ msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
|
|
22c937 |
+ 'TypeError:("\'FailingNumber\' object is not iterable",)')
|
|
|
22c937 |
+ if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
|
|
|
22c937 |
+ msg = msg.replace('(\'', '("').replace('\',)', '",)')
|
|
|
22c937 |
+ if expr == 'fd(self=[])':
|
|
|
22c937 |
+ # HACK: PyMapping_Check changed meaning
|
|
|
22c937 |
+ msg = msg.replace('AttributeError:(\'keys\',)',
|
|
|
22c937 |
+ 'TypeError:(\'unable to convert list to vim dictionary\',)')
|
|
|
22c937 |
+ vim.current.buffer.append(expr + ':' + msg)
|
|
|
22c937 |
+ else:
|
|
|
22c937 |
+ vim.current.buffer.append(expr + ':NOT FAILED')
|
|
|
22c937 |
+ EOF
|
|
|
22c937 |
:fun New(...)
|
|
|
22c937 |
: return ['NewStart']+a:000+['NewEnd']
|
|
|
22c937 |
:endfun
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 193,210 ****
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:py l.extend([l[0].name])
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
! :try
|
|
|
22c937 |
! : py l[1](1, 2, 3)
|
|
|
22c937 |
! :catch
|
|
|
22c937 |
! : $put =v:exception[:16]
|
|
|
22c937 |
! :endtry
|
|
|
22c937 |
:py f=l[0]
|
|
|
22c937 |
:delfunction New
|
|
|
22c937 |
! :try
|
|
|
22c937 |
! : py f(1, 2, 3)
|
|
|
22c937 |
! :catch
|
|
|
22c937 |
! : $put =v:exception[:16]
|
|
|
22c937 |
! :endtry
|
|
|
22c937 |
:if has('float')
|
|
|
22c937 |
: let l=[0.0]
|
|
|
22c937 |
: py l=vim.bindeval('l')
|
|
|
22c937 |
--- 219,228 ----
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:py l.extend([l[0].name])
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
! :py ee('l[1](1, 2, 3)')
|
|
|
22c937 |
:py f=l[0]
|
|
|
22c937 |
:delfunction New
|
|
|
22c937 |
! :py ee('f(1, 2, 3)')
|
|
|
22c937 |
:if has('float')
|
|
|
22c937 |
: let l=[0.0]
|
|
|
22c937 |
: py l=vim.bindeval('l')
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 216,222 ****
|
|
|
22c937 |
:let messages=[]
|
|
|
22c937 |
:delfunction DictNew
|
|
|
22c937 |
py <
|
|
|
22c937 |
- import sys
|
|
|
22c937 |
d=vim.bindeval('{}')
|
|
|
22c937 |
m=vim.bindeval('messages')
|
|
|
22c937 |
def em(expr, g=globals(), l=locals()):
|
|
|
22c937 |
--- 234,239 ----
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 323,328 ****
|
|
|
22c937 |
--- 340,346 ----
|
|
|
22c937 |
:py l[0] = t.t > 8 # check if the background thread is working
|
|
|
22c937 |
:py del time
|
|
|
22c937 |
:py del threading
|
|
|
22c937 |
+ :py del t
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:"
|
|
|
22c937 |
:" settrace
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 882,910 ****
|
|
|
22c937 |
:fun D()
|
|
|
22c937 |
:endfun
|
|
|
22c937 |
py << EOF
|
|
|
22c937 |
- def ee(expr, g=globals(), l=locals()):
|
|
|
22c937 |
- try:
|
|
|
22c937 |
- exec(expr, g, l)
|
|
|
22c937 |
- except:
|
|
|
22c937 |
- ei = sys.exc_info()
|
|
|
22c937 |
- msg = sys.exc_info()[0].__name__ + ':' + repr(sys.exc_info()[1].args)
|
|
|
22c937 |
- msg = msg.replace('TypeError:(\'argument 1 ', 'TypeError:(\'')
|
|
|
22c937 |
- if expr.find('None') > -1:
|
|
|
22c937 |
- msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
|
|
22c937 |
- 'TypeError:("\'NoneType\' object is not iterable",)')
|
|
|
22c937 |
- if expr.find('FailingNumber') > -1:
|
|
|
22c937 |
- msg = msg.replace(', not \'FailingNumber\'', '').replace('"', '\'')
|
|
|
22c937 |
- msg = msg.replace('TypeError:(\'iteration over non-sequence\',)',
|
|
|
22c937 |
- 'TypeError:("\'FailingNumber\' object is not iterable",)')
|
|
|
22c937 |
- if msg.find('(\'\'') > -1 or msg.find('(\'can\'t') > -1:
|
|
|
22c937 |
- msg = msg.replace('(\'', '("').replace('\',)', '",)')
|
|
|
22c937 |
- if expr == 'fd(self=[])':
|
|
|
22c937 |
- # HACK: PyMapping_Check changed meaning
|
|
|
22c937 |
- msg = msg.replace('AttributeError:(\'keys\',)',
|
|
|
22c937 |
- 'TypeError:(\'unable to convert list to vim dictionary\',)')
|
|
|
22c937 |
- cb.append(expr + ':' + msg)
|
|
|
22c937 |
- else:
|
|
|
22c937 |
- cb.append(expr + ':NOT FAILED')
|
|
|
22c937 |
d = vim.Dictionary()
|
|
|
22c937 |
ned = vim.Dictionary(foo='bar', baz='abcD')
|
|
|
22c937 |
dl = vim.Dictionary(a=1)
|
|
|
22c937 |
--- 900,905 ----
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1276,1281 ****
|
|
|
22c937 |
--- 1271,1277 ----
|
|
|
22c937 |
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
|
|
22c937 |
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
|
|
22c937 |
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
|
|
22c937 |
+ ee('vim.eval("xxx_unknown_function_xxx()")')
|
|
|
22c937 |
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
|
|
22c937 |
del Exe
|
|
|
22c937 |
EOF
|
|
|
22c937 |
*** ../vim-7.4.106/src/testdir/test86.ok 2013-11-11 01:05:43.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test86.ok 2013-11-28 16:41:01.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 53,60 ****
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
|
|
|
22c937 |
! Vim(python):E725:
|
|
|
22c937 |
! Vim(python):E117:
|
|
|
22c937 |
[0.0, 0.0]
|
|
|
22c937 |
KeyError
|
|
|
22c937 |
TypeError
|
|
|
22c937 |
--- 53,60 ----
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
|
|
|
22c937 |
! l[1](1, 2, 3):error:('Vim:E725: Calling dict function without Dictionary: DictNew',)
|
|
|
22c937 |
! f(1, 2, 3):error:('Vim:E117: Unknown function: New',)
|
|
|
22c937 |
[0.0, 0.0]
|
|
|
22c937 |
KeyError
|
|
|
22c937 |
TypeError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1197,1202 ****
|
|
|
22c937 |
--- 1197,1203 ----
|
|
|
22c937 |
vim.eval("Exe('throw ''ghi''')"):error:('ghi',)
|
|
|
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.eval("xxx_unknown_function_xxx()"):error:('Vim:E117: Unknown function: xxx_unknown_function_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 |
*** ../vim-7.4.106/src/testdir/test87.in 2013-11-11 01:05:43.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test87.in 2013-11-28 16:41:01.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 172,177 ****
|
|
|
22c937 |
--- 172,207 ----
|
|
|
22c937 |
:unlockvar! l
|
|
|
22c937 |
:"
|
|
|
22c937 |
:" Function calls
|
|
|
22c937 |
+ py3 << EOF
|
|
|
22c937 |
+ import sys
|
|
|
22c937 |
+ import re
|
|
|
22c937 |
+
|
|
|
22c937 |
+ py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$')
|
|
|
22c937 |
+
|
|
|
22c937 |
+ def ee(expr, g=globals(), l=locals()):
|
|
|
22c937 |
+ cb = vim.current.buffer
|
|
|
22c937 |
+ try:
|
|
|
22c937 |
+ try:
|
|
|
22c937 |
+ exec(expr, g, l)
|
|
|
22c937 |
+ except Exception as e:
|
|
|
22c937 |
+ if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
|
|
|
22c937 |
+ cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1]))))
|
|
|
22c937 |
+ elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0:
|
|
|
22c937 |
+ cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", '')))))
|
|
|
22c937 |
+ elif sys.version_info >= (3, 3) and e.__class__ is TypeError:
|
|
|
22c937 |
+ m = py33_type_error_pattern.search(str(e))
|
|
|
22c937 |
+ if m:
|
|
|
22c937 |
+ msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2))
|
|
|
22c937 |
+ cb.append(expr + ':' + repr((e.__class__, TypeError(msg))))
|
|
|
22c937 |
+ else:
|
|
|
22c937 |
+ cb.append(expr + ':' + repr((e.__class__, e)))
|
|
|
22c937 |
+ else:
|
|
|
22c937 |
+ cb.append(expr + ':' + repr((e.__class__, e)))
|
|
|
22c937 |
+ else:
|
|
|
22c937 |
+ cb.append(expr + ':NOT FAILED')
|
|
|
22c937 |
+ except Exception as e:
|
|
|
22c937 |
+ cb.append(expr + '::' + repr((e.__class__, e)))
|
|
|
22c937 |
+ EOF
|
|
|
22c937 |
:fun New(...)
|
|
|
22c937 |
: return ['NewStart']+a:000+['NewEnd']
|
|
|
22c937 |
:endfun
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 186,203 ****
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:py3 l+=[l[0].name]
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
! :try
|
|
|
22c937 |
! : py3 l[1](1, 2, 3)
|
|
|
22c937 |
! :catch
|
|
|
22c937 |
! : $put =v:exception[:13]
|
|
|
22c937 |
! :endtry
|
|
|
22c937 |
:py3 f=l[0]
|
|
|
22c937 |
:delfunction New
|
|
|
22c937 |
! :try
|
|
|
22c937 |
! : py3 f(1, 2, 3)
|
|
|
22c937 |
! :catch
|
|
|
22c937 |
! : $put =v:exception[:13]
|
|
|
22c937 |
! :endtry
|
|
|
22c937 |
:if has('float')
|
|
|
22c937 |
: let l=[0.0]
|
|
|
22c937 |
: py3 l=vim.bindeval('l')
|
|
|
22c937 |
--- 216,225 ----
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:py3 l+=[l[0].name]
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
! :py3 ee('l[1](1, 2, 3)')
|
|
|
22c937 |
:py3 f=l[0]
|
|
|
22c937 |
:delfunction New
|
|
|
22c937 |
! :py3 ee('f(1, 2, 3)')
|
|
|
22c937 |
:if has('float')
|
|
|
22c937 |
: let l=[0.0]
|
|
|
22c937 |
: py3 l=vim.bindeval('l')
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 315,320 ****
|
|
|
22c937 |
--- 337,343 ----
|
|
|
22c937 |
:py3 l[0] = t.t > 8 # check if the background thread is working
|
|
|
22c937 |
:py3 del time
|
|
|
22c937 |
:py3 del threading
|
|
|
22c937 |
+ :py3 del t
|
|
|
22c937 |
:$put =string(l)
|
|
|
22c937 |
:"
|
|
|
22c937 |
:" settrace
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 829,861 ****
|
|
|
22c937 |
:fun D()
|
|
|
22c937 |
:endfun
|
|
|
22c937 |
py3 << EOF
|
|
|
22c937 |
- import re
|
|
|
22c937 |
-
|
|
|
22c937 |
- py33_type_error_pattern = re.compile('^__call__\(\) takes (\d+) positional argument but (\d+) were given$')
|
|
|
22c937 |
-
|
|
|
22c937 |
- def ee(expr, g=globals(), l=locals()):
|
|
|
22c937 |
- try:
|
|
|
22c937 |
- try:
|
|
|
22c937 |
- exec(expr, g, l)
|
|
|
22c937 |
- except Exception as e:
|
|
|
22c937 |
- if sys.version_info >= (3, 3) and e.__class__ is AttributeError and str(e).find('has no attribute')>=0 and not str(e).startswith("'vim."):
|
|
|
22c937 |
- cb.append(expr + ':' + repr((e.__class__, AttributeError(str(e)[str(e).rfind(" '") + 2:-1]))))
|
|
|
22c937 |
- elif sys.version_info >= (3, 3) and e.__class__ is ImportError and str(e).find('No module named \'') >= 0:
|
|
|
22c937 |
- cb.append(expr + ':' + repr((e.__class__, ImportError(str(e).replace("'", '')))))
|
|
|
22c937 |
- elif sys.version_info >= (3, 3) and e.__class__ is TypeError:
|
|
|
22c937 |
- m = py33_type_error_pattern.search(str(e))
|
|
|
22c937 |
- if m:
|
|
|
22c937 |
- msg = '__call__() takes exactly {0} positional argument ({1} given)'.format(m.group(1), m.group(2))
|
|
|
22c937 |
- cb.append(expr + ':' + repr((e.__class__, TypeError(msg))))
|
|
|
22c937 |
- else:
|
|
|
22c937 |
- cb.append(expr + ':' + repr((e.__class__, e)))
|
|
|
22c937 |
- else:
|
|
|
22c937 |
- cb.append(expr + ':' + repr((e.__class__, e)))
|
|
|
22c937 |
- else:
|
|
|
22c937 |
- cb.append(expr + ':NOT FAILED')
|
|
|
22c937 |
- except Exception as e:
|
|
|
22c937 |
- cb.append(expr + '::' + repr((e.__class__, e)))
|
|
|
22c937 |
-
|
|
|
22c937 |
d = vim.Dictionary()
|
|
|
22c937 |
ned = vim.Dictionary(foo='bar', baz='abcD')
|
|
|
22c937 |
dl = vim.Dictionary(a=1)
|
|
|
22c937 |
--- 852,857 ----
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1227,1232 ****
|
|
|
22c937 |
--- 1223,1229 ----
|
|
|
22c937 |
ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")')
|
|
|
22c937 |
ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")')
|
|
|
22c937 |
ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")')
|
|
|
22c937 |
+ ee('vim.eval("xxx_unknown_function_xxx()")')
|
|
|
22c937 |
ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")')
|
|
|
22c937 |
del Exe
|
|
|
22c937 |
EOF
|
|
|
22c937 |
*** ../vim-7.4.106/src/testdir/test87.ok 2013-11-11 01:05:43.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test87.ok 2013-11-28 16:41:01.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 53,60 ****
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
|
|
|
22c937 |
! Vim(py3):E725:
|
|
|
22c937 |
! Vim(py3):E117:
|
|
|
22c937 |
[0.0, 0.0]
|
|
|
22c937 |
KeyError
|
|
|
22c937 |
TypeError
|
|
|
22c937 |
--- 53,60 ----
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd']
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}]
|
|
|
22c937 |
[function('New'), function('DictNew'), 'NewStart', 1, 2, 3, 'NewEnd', 'DictNewStart', 1, 2, 3, 'DictNewEnd', {'a': 'b'}, 'New']
|
|
|
22c937 |
! l[1](1, 2, 3):(<class 'vim.error'>, error('Vim:E725: Calling dict function without Dictionary: DictNew',))
|
|
|
22c937 |
! f(1, 2, 3):(<class 'vim.error'>, error('Vim:E117: Unknown function: New',))
|
|
|
22c937 |
[0.0, 0.0]
|
|
|
22c937 |
KeyError
|
|
|
22c937 |
TypeError
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1186,1191 ****
|
|
|
22c937 |
--- 1186,1192 ----
|
|
|
22c937 |
vim.eval("Exe('throw ''ghi''')"):(<class 'vim.error'>, error('ghi',))
|
|
|
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.eval("xxx_unknown_function_xxx()"):(<class 'vim.error'>, error('Vim:E117: Unknown function: xxx_unknown_function_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 |
*** ../vim-7.4.106/src/version.c 2013-11-28 16:32:34.000000000 +0100
|
|
|
22c937 |
--- src/version.c 2013-11-28 16:41:43.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 740,741 ****
|
|
|
22c937 |
--- 740,743 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 107,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
8. You spend half of the plane trip with your laptop on your lap...and your
|
|
|
22c937 |
child in the overhead compartment.
|
|
|
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 ///
|