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