Karsten Hopp 68ba24
To: vim_dev@googlegroups.com
Karsten Hopp 68ba24
Subject: Patch 7.3.1229
Karsten Hopp 68ba24
Fcc: outbox
Karsten Hopp 68ba24
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 68ba24
Mime-Version: 1.0
Karsten Hopp 68ba24
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 68ba24
Content-Transfer-Encoding: 8bit
Karsten Hopp 68ba24
------------
Karsten Hopp 68ba24
Karsten Hopp 68ba24
Patch 7.3.1229
Karsten Hopp 68ba24
Problem:    Python: not so easy to delete/restore translating.
Karsten Hopp 68ba24
Solution:   Make macros do translation of exception messages. (ZyX)
Karsten Hopp 68ba24
            Note: this breaks translations!
Karsten Hopp 68ba24
Files:      src/if_py_both.h, src/if_python3.c
Karsten Hopp 68ba24
Karsten Hopp 68ba24
Karsten Hopp 68ba24
*** ../vim-7.3.1228/src/if_py_both.h	2013-06-23 13:11:14.000000000 +0200
Karsten Hopp 68ba24
--- src/if_py_both.h	2013-06-23 13:19:01.000000000 +0200
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 26,35 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  static const char *vim_special_path = "_vim_path_";
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
! #define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
Karsten Hopp 68ba24
! 						_("empty keys are not allowed"))
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
Karsten Hopp 68ba24
  #define INVALID_WINDOW_VALUE ((win_T *)(-1))
Karsten Hopp 68ba24
--- 26,37 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  static const char *vim_special_path = "_vim_path_";
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
+ #define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
Karsten Hopp 68ba24
  #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
Karsten Hopp 68ba24
+ #define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
! #define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \
Karsten Hopp 68ba24
! 						"empty keys are not allowed")
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
Karsten Hopp 68ba24
  #define INVALID_WINDOW_VALUE ((win_T *)(-1))
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 120,126 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("object must be string"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 122,128 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "object must be string");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 212,219 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		_("can't delete OutputObject attributes"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 214,221 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		"can't delete OutputObject attributes");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 221,227 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (!PyInt_Check(val))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("softspace must be an integer"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 223,229 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (!PyInt_Check(val))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "softspace must be an integer");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 229,235 ****
Karsten Hopp 68ba24
  	return 0;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SetString(PyExc_AttributeError, _("invalid attribute"));
Karsten Hopp 68ba24
      return -1;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 231,237 ----
Karsten Hopp 68ba24
  	return 0;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SET_STRING(PyExc_AttributeError, "invalid attribute");
Karsten Hopp 68ba24
      return -1;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 667,673 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (our_tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("invalid expression"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 669,675 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (our_tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("invalid expression");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 718,724 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (our_tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("invalid expression"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 720,726 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (our_tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("invalid expression");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 790,796 ****
Karsten Hopp 68ba24
  	if (VimTryEnd())
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("failed to change directory"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 792,798 ----
Karsten Hopp 68ba24
  	if (VimTryEnd())
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("failed to change directory");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 968,975 ****
Karsten Hopp 68ba24
      if (!PyTuple_Check(find_module_result)
Karsten Hopp 68ba24
  	    || PyTuple_GET_SIZE(find_module_result) != 3)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 68ba24
! 		_("expected 3-tuple as imp.find_module() result"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 970,977 ----
Karsten Hopp 68ba24
      if (!PyTuple_Check(find_module_result)
Karsten Hopp 68ba24
  	    || PyTuple_GET_SIZE(find_module_result) != 3)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError,
Karsten Hopp 68ba24
! 		"expected 3-tuple as imp.find_module() result");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 977,984 ****
Karsten Hopp 68ba24
  	    || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
Karsten Hopp 68ba24
  	    || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		_("internal error: imp.find_module returned tuple with NULL"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 979,986 ----
Karsten Hopp 68ba24
  	    || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
Karsten Hopp 68ba24
  	    || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		"internal error: imp.find_module returned tuple with NULL");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1349,1356 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		_("cannot delete vim.Dictionary attributes"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 1351,1358 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		"cannot delete vim.Dictionary attributes");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1358,1364 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->dict->dv_lock == VAR_FIXED)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("cannot modify fixed dictionary"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
--- 1360,1366 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->dict->dv_lock == VAR_FIXED)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed dictionary");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1375,1381 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1377,1383 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1457,1463 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (dict->dv_lock)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("dict is locked"));
Karsten Hopp 68ba24
  	    Py_DECREF(r);
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
--- 1459,1465 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (dict->dv_lock)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("dict is locked");
Karsten Hopp 68ba24
  	    Py_DECREF(r);
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1508,1515 ****
Karsten Hopp 68ba24
      if ((*dii)->ht->ht_array != (*dii)->ht_array ||
Karsten Hopp 68ba24
  	    (*dii)->ht->ht_used != (*dii)->ht_used)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		_("hashtab changed during iteration"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 1510,1517 ----
Karsten Hopp 68ba24
      if ((*dii)->ht->ht_array != (*dii)->ht_array ||
Karsten Hopp 68ba24
  	    (*dii)->ht->ht_used != (*dii)->ht_used)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		"hashtab changed during iteration");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1560,1566 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (dict->dv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("dict is locked"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 1562,1568 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (dict->dv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("dict is locked");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1615,1621 ****
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    vim_free(di);
Karsten Hopp 68ba24
  	    dictitem_free(di);
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
--- 1617,1623 ----
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    vim_free(di);
Karsten Hopp 68ba24
  	    dictitem_free(di);
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to add key to dictionary");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1723,1729 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (dict->dv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("dict is locked"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 1725,1731 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (dict->dv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("dict is locked");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1779,1786 ****
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
  		    Py_DECREF(iterator);
Karsten Hopp 68ba24
  		    Py_DECREF(fast);
Karsten Hopp 68ba24
! 		    PyErr_SetString(PyExc_ValueError,
Karsten Hopp 68ba24
! 			    _("expected sequence element of size 2"));
Karsten Hopp 68ba24
  		    return NULL;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 1781,1788 ----
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
  		    Py_DECREF(iterator);
Karsten Hopp 68ba24
  		    Py_DECREF(fast);
Karsten Hopp 68ba24
! 		    PyErr_SET_STRING(PyExc_ValueError,
Karsten Hopp 68ba24
! 			    "expected sequence element of size 2");
Karsten Hopp 68ba24
  		    return NULL;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1823,1829 ****
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
  		    Py_DECREF(iterator);
Karsten Hopp 68ba24
  		    dictitem_free(di);
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 68ba24
  		    return NULL;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
--- 1825,1831 ----
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
  		    Py_DECREF(iterator);
Karsten Hopp 68ba24
  		    dictitem_free(di);
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("failed to add key to dictionary");
Karsten Hopp 68ba24
  		    return NULL;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2021,2028 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (kwargs)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 68ba24
! 		_("list constructor does not accept keyword arguments"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2023,2030 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (kwargs)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError,
Karsten Hopp 68ba24
! 		"list constructor does not accept keyword arguments");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2077,2089 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (index >= ListLength(self))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      li = list_find(self->list, (long) index);
Karsten Hopp 68ba24
      if (li == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("internal error: failed to get vim list item"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      return ConvertToPyObject(&li->li_tv);
Karsten Hopp 68ba24
--- 2079,2091 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (index >= ListLength(self))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      li = list_find(self->list, (long) index);
Karsten Hopp 68ba24
      if (li == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("internal error: failed to get vim list item");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      return ConvertToPyObject(&li->li_tv);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2196,2207 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("list is locked"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      if (index>length || (index==length && obj==NULL))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2198,2209 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("list is locked");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      if (index>length || (index==length && obj==NULL))
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2222,2228 ****
Karsten Hopp 68ba24
  	if (list_append_tv(l, &tv) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    clear_tv(&tv;;
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to add item to list"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
--- 2224,2230 ----
Karsten Hopp 68ba24
  	if (list_append_tv(l, &tv) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    clear_tv(&tv;;
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to add item to list");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2250,2256 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("list is locked"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2252,2258 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("list is locked");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2263,2269 ****
Karsten Hopp 68ba24
  	li = list_find(l, (long) first);
Karsten Hopp 68ba24
  	if (li == NULL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("internal error: no vim list item"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	if (last > first)
Karsten Hopp 68ba24
--- 2265,2271 ----
Karsten Hopp 68ba24
  	li = list_find(l, (long) first);
Karsten Hopp 68ba24
  	if (li == NULL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("internal error: no vim list item");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	if (last > first)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2296,2302 ****
Karsten Hopp 68ba24
  	if (list_insert_tv(l, &v, li) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    clear_tv(&v);
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("internal error: failed to add item to list"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	clear_tv(&v);
Karsten Hopp 68ba24
--- 2298,2304 ----
Karsten Hopp 68ba24
  	if (list_insert_tv(l, &v, li) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    clear_tv(&v);
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("internal error: failed to add item to list");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	clear_tv(&v);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2313,2319 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("list is locked"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2315,2321 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (l->lv_lock)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("list is locked");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2347,2354 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		_("cannot delete vim.List attributes"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2349,2356 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (val == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_AttributeError,
Karsten Hopp 68ba24
! 		"cannot delete vim.List attributes");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2356,2362 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->list->lv_lock == VAR_FIXED)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
--- 2358,2364 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->list->lv_lock == VAR_FIXED)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed list");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2373,2379 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 2375,2381 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2408,2415 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (!translated_function_exists(name))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_ValueError,
Karsten Hopp 68ba24
! 		    _("unnamed function does not exist"));
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	self->name = vim_strsave(name);
Karsten Hopp 68ba24
--- 2410,2417 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (!translated_function_exists(name))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_ValueError,
Karsten Hopp 68ba24
! 		    "unnamed function does not exist");
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	self->name = vim_strsave(name);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2420,2426 ****
Karsten Hopp 68ba24
  				    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
Karsten Hopp 68ba24
  		== NULL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_ValueError, _("function does not exist"));
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2422,2428 ----
Karsten Hopp 68ba24
  				    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
Karsten Hopp 68ba24
  		== NULL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_ValueError, "function does not exist");
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2435,2442 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (kwargs)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 68ba24
! 		_("function constructor does not accept keyword arguments"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2437,2444 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (kwargs)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError,
Karsten Hopp 68ba24
! 		"function constructor does not accept keyword arguments");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2513,2519 ****
Karsten Hopp 68ba24
      else if (error != OK)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	result = NULL;
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("failed to run function"));
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
  	result = ConvertToPyObject(&rettv);
Karsten Hopp 68ba24
--- 2515,2521 ----
Karsten Hopp 68ba24
      else if (error != OK)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	result = NULL;
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("failed to run function");
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
  	result = ConvertToPyObject(&rettv);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2658,2671 ****
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    _("unable to get option value"));
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim("Internal error: unknown option type. Should not happen");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 2660,2673 ----
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    "unable to get option value");
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("internal error: unknown option type");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2708,2714 ****
Karsten Hopp 68ba24
  	    {
Karsten Hopp 68ba24
  		if (VimTryEnd())
Karsten Hopp 68ba24
  		    return -1;
Karsten Hopp 68ba24
! 		PyErr_SetVim("Problem while switching windows.");
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
Karsten Hopp 68ba24
--- 2710,2716 ----
Karsten Hopp 68ba24
  	    {
Karsten Hopp 68ba24
  		if (VimTryEnd())
Karsten Hopp 68ba24
  		    return -1;
Karsten Hopp 68ba24
! 		PyErr_SET_VIM("problem while switching windows");
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2768,2782 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->opt_type == SREQ_GLOBAL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_ValueError,
Karsten Hopp 68ba24
! 		    _("unable to unset global option"));
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else if (!(flags & SOPT_GLOBAL))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_ValueError, _("unable to unset option "
Karsten Hopp 68ba24
! 						"without global value"));
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
--- 2770,2783 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (self->opt_type == SREQ_GLOBAL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_ValueError, "unable to unset global option");
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else if (!(flags & SOPT_GLOBAL))
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_ValueError, "unable to unset option "
Karsten Hopp 68ba24
! 					       "without global value");
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2813,2819 ****
Karsten Hopp 68ba24
  	    val = PyLong_AsLong(valObject);
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("object must be integer"));
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
--- 2814,2820 ----
Karsten Hopp 68ba24
  	    val = PyLong_AsLong(valObject);
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "object must be integer");
Karsten Hopp 68ba24
  	    Py_XDECREF(todecref);
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 2862,2868 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->tab == INVALID_TABPAGE_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("attempt to refer to deleted tab page"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 2863,2869 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->tab == INVALID_TABPAGE_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("attempt to refer to deleted tab page");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3006,3012 ****
Karsten Hopp 68ba24
  	if (n == 0)
Karsten Hopp 68ba24
  	    return TabPageNew(tp);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SetString(PyExc_IndexError, _("no such tab page"));
Karsten Hopp 68ba24
      return NULL;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3007,3013 ----
Karsten Hopp 68ba24
  	if (n == 0)
Karsten Hopp 68ba24
  	    return TabPageNew(tp);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SET_STRING(PyExc_IndexError, "no such tab page");
Karsten Hopp 68ba24
      return NULL;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3028,3034 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->win == INVALID_WINDOW_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("attempt to refer to deleted window"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3029,3035 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->win == INVALID_WINDOW_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("attempt to refer to deleted window");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3194,3200 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (strcmp(name, "buffer") == 0)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("readonly attribute"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else if (strcmp(name, "cursor") == 0)
Karsten Hopp 68ba24
--- 3195,3201 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (strcmp(name, "buffer") == 0)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "readonly attribute");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else if (strcmp(name, "cursor") == 0)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3207,3213 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cursor position outside buffer"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3208,3214 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cursor position outside buffer");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3370,3376 ****
Karsten Hopp 68ba24
  	if (n == 0)
Karsten Hopp 68ba24
  	    return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SetString(PyExc_IndexError, _("no such window"));
Karsten Hopp 68ba24
      return NULL;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3371,3377 ----
Karsten Hopp 68ba24
  	if (n == 0)
Karsten Hopp 68ba24
  	    return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
!     PyErr_SET_STRING(PyExc_IndexError, "no such window");
Karsten Hopp 68ba24
      return NULL;
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3424,3430 ****
Karsten Hopp 68ba24
  	    --len;
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("string cannot contain newlines"));
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
--- 3425,3431 ----
Karsten Hopp 68ba24
  	    --len;
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("string cannot contain newlines");
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3557,3565 ****
Karsten Hopp 68ba24
  	VimTryStart();
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savedel((linenr_T)n, 1L) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot delete line"));
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (buf == savebuf)
Karsten Hopp 68ba24
--- 3558,3566 ----
Karsten Hopp 68ba24
  	VimTryStart();
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savedel((linenr_T)n, 1L) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot delete line");
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (buf == savebuf)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3593,3604 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savesub((linenr_T)n) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  	    vim_free(save);
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot replace line"));
Karsten Hopp 68ba24
  	    vim_free(save);
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
--- 3594,3605 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savesub((linenr_T)n) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  	    vim_free(save);
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot replace line");
Karsten Hopp 68ba24
  	    vim_free(save);
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3653,3666 ****
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savedel((linenr_T)lo, (long)n) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    for (i = 0; i < n; ++i)
Karsten Hopp 68ba24
  	    {
Karsten Hopp 68ba24
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("cannot delete line"));
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
--- 3654,3667 ----
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_savedel((linenr_T)lo, (long)n) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    for (i = 0; i < n; ++i)
Karsten Hopp 68ba24
  	    {
Karsten Hopp 68ba24
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("cannot delete line");
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3721,3727 ****
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	/* If the size of the range is reducing (ie, new_len < old_len) we
Karsten Hopp 68ba24
  	 * need to delete some old_len. We do this at the start, by
Karsten Hopp 68ba24
--- 3722,3728 ----
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	/* If the size of the range is reducing (ie, new_len < old_len) we
Karsten Hopp 68ba24
  	 * need to delete some old_len. We do this at the start, by
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3732,3738 ****
Karsten Hopp 68ba24
  	    for (i = 0; i < old_len - new_len; ++i)
Karsten Hopp 68ba24
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("cannot delete line"));
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    extra -= i;
Karsten Hopp 68ba24
--- 3733,3739 ----
Karsten Hopp 68ba24
  	    for (i = 0; i < old_len - new_len; ++i)
Karsten Hopp 68ba24
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("cannot delete line");
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	    extra -= i;
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3748,3754 ****
Karsten Hopp 68ba24
  		if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
Karsten Hopp 68ba24
  								      == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("cannot replace line"));
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
--- 3749,3755 ----
Karsten Hopp 68ba24
  		if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
Karsten Hopp 68ba24
  								      == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("cannot replace line");
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3766,3772 ****
Karsten Hopp 68ba24
  		if (ml_append((linenr_T)(lo + i - 1),
Karsten Hopp 68ba24
  					(char_u *)array[i], 0, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("cannot insert line"));
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  		vim_free(array[i]);
Karsten Hopp 68ba24
--- 3767,3773 ----
Karsten Hopp 68ba24
  		if (ml_append((linenr_T)(lo + i - 1),
Karsten Hopp 68ba24
  					(char_u *)array[i], 0, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("cannot insert line");
Karsten Hopp 68ba24
  		    break;
Karsten Hopp 68ba24
  		}
Karsten Hopp 68ba24
  		vim_free(array[i]);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3843,3851 ****
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot insert line"));
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	    appended_lines_mark((linenr_T)n, 1L);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3844,3852 ----
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot insert line");
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	    appended_lines_mark((linenr_T)n, 1L);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3894,3900 ****
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("cannot save undo information"));
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    for (i = 0; i < size; ++i)
Karsten Hopp 68ba24
--- 3895,3901 ----
Karsten Hopp 68ba24
  	switch_buffer(&savebuf, buf);
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("cannot save undo information");
Karsten Hopp 68ba24
  	else
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    for (i = 0; i < size; ++i)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3902,3908 ****
Karsten Hopp 68ba24
  		if (ml_append((linenr_T)(n + i),
Karsten Hopp 68ba24
  					(char_u *)array[i], 0, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SetVim(_("cannot insert line"));
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  		    /* Free the rest of the lines */
Karsten Hopp 68ba24
  		    while (i < size)
Karsten Hopp 68ba24
--- 3903,3909 ----
Karsten Hopp 68ba24
  		if (ml_append((linenr_T)(n + i),
Karsten Hopp 68ba24
  					(char_u *)array[i], 0, FALSE) == FAIL)
Karsten Hopp 68ba24
  		{
Karsten Hopp 68ba24
! 		    PyErr_SET_VIM("cannot insert line");
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  		    /* Free the rest of the lines */
Karsten Hopp 68ba24
  		    while (i < size)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3955,3961 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->buf == INVALID_BUFFER_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("attempt to refer to deleted buffer"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3956,3962 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (self->buf == INVALID_BUFFER_VALUE)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("attempt to refer to deleted buffer");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 3976,3982 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > end - start)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 3977,3983 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > end - start)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4026,4032 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > end - start)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4027,4033 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > end - start)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4098,4104 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > max)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4099,4105 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (n < 0 || n > max)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4381,4387 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (r == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to rename buffer"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	return 0;
Karsten Hopp 68ba24
--- 4382,4388 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (r == FAIL)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to rename buffer");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  	return 0;
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4416,4423 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (pmark[0] == '\0' || pmark[1] != '\0')
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_ValueError,
Karsten Hopp 68ba24
! 		_("mark name must be a single character"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4417,4424 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (pmark[0] == '\0' || pmark[1] != '\0')
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_ValueError,
Karsten Hopp 68ba24
! 		"mark name must be a single character");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4434,4440 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (posp == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("invalid mark name"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4435,4441 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
      if (posp == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("invalid mark name");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4529,4535 ****
Karsten Hopp 68ba24
  	bnr = PyLong_AsLong(keyObject);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("key must be integer"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4530,4536 ----
Karsten Hopp 68ba24
  	bnr = PyLong_AsLong(keyObject);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "key must be integer");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4667,4673 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (value->ob_type != &BufferType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.Buffer object"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4668,4674 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (value->ob_type != &BufferType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.Buffer object");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4680,4686 ****
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to switch to given buffer"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4681,4687 ----
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to switch to given buffer");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4692,4698 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (value->ob_type != &WindowType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.Window object"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4693,4699 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (value->ob_type != &WindowType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.Window object");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4702,4709 ****
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (!count)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_ValueError,
Karsten Hopp 68ba24
! 		    _("failed to find window in the current tab page"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4703,4710 ----
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
  	if (!count)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_ValueError,
Karsten Hopp 68ba24
! 		    "failed to find window in the current tab page");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4713,4720 ****
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    _("did not switch to the specified window"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4714,4721 ----
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    "did not switch to the specified window");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4724,4730 ****
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (value->ob_type != &TabPageType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.TabPage object"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4725,4731 ----
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
  	if (value->ob_type != &TabPageType)
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.TabPage object");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 4737,4744 ****
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SetString(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    _("did not switch to the specified tab page"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
--- 4738,4745 ----
Karsten Hopp 68ba24
  	{
Karsten Hopp 68ba24
  	    if (VimTryEnd())
Karsten Hopp 68ba24
  		return -1;
Karsten Hopp 68ba24
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
Karsten Hopp 68ba24
! 		    "did not switch to the specified tab page");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
  
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5005,5011 ****
Karsten Hopp 68ba24
  	    clear_tv(&di->di_tv);
Karsten Hopp 68ba24
  	    vim_free(di);
Karsten Hopp 68ba24
  	    dict_unref(dict);
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
--- 5006,5012 ----
Karsten Hopp 68ba24
  	    clear_tv(&di->di_tv);
Karsten Hopp 68ba24
  	    vim_free(di);
Karsten Hopp 68ba24
  	    dict_unref(dict);
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to add key to dictionary");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5107,5113 ****
Karsten Hopp 68ba24
  	    Py_DECREF(iterator);
Karsten Hopp 68ba24
  	    dictitem_free(di);
Karsten Hopp 68ba24
  	    dict_unref(dict);
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
--- 5108,5114 ----
Karsten Hopp 68ba24
  	    Py_DECREF(iterator);
Karsten Hopp 68ba24
  	    dictitem_free(di);
Karsten Hopp 68ba24
  	    dict_unref(dict);
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("failed to add key to dictionary");
Karsten Hopp 68ba24
  	    return -1;
Karsten Hopp 68ba24
  	}
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5215,5222 ****
Karsten Hopp 68ba24
  	r = convert_dl(obj, tv, pymap_to_tv, lookup_dict);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 68ba24
! 		_("unable to convert object to vim dictionary"));
Karsten Hopp 68ba24
  	r = -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      Py_DECREF(lookup_dict);
Karsten Hopp 68ba24
--- 5216,5223 ----
Karsten Hopp 68ba24
  	r = convert_dl(obj, tv, pymap_to_tv, lookup_dict);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError,
Karsten Hopp 68ba24
! 		"unable to convert object to vim dictionary");
Karsten Hopp 68ba24
  	r = -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      Py_DECREF(lookup_dict);
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5325,5332 ****
Karsten Hopp 68ba24
  	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError,
Karsten Hopp 68ba24
! 		_("unable to convert to vim structure"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      return 0;
Karsten Hopp 68ba24
--- 5326,5333 ----
Karsten Hopp 68ba24
  	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError,
Karsten Hopp 68ba24
! 		"unable to convert to vim structure");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      return 0;
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5337,5343 ****
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetVim(_("NULL reference passed"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      switch (tv->v_type)
Karsten Hopp 68ba24
--- 5338,5344 ----
Karsten Hopp 68ba24
  {
Karsten Hopp 68ba24
      if (tv == NULL)
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_VIM("NULL reference passed");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      switch (tv->v_type)
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 5362,5368 ****
Karsten Hopp 68ba24
  	    Py_INCREF(Py_None);
Karsten Hopp 68ba24
  	    return Py_None;
Karsten Hopp 68ba24
  	default:
Karsten Hopp 68ba24
! 	    PyErr_SetVim(_("internal error: invalid value type"));
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 5363,5369 ----
Karsten Hopp 68ba24
  	    Py_INCREF(Py_None);
Karsten Hopp 68ba24
  	    return Py_None;
Karsten Hopp 68ba24
  	default:
Karsten Hopp 68ba24
! 	    PyErr_SET_VIM("internal error: invalid value type");
Karsten Hopp 68ba24
  	    return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
*** ../vim-7.3.1228/src/if_python3.c	2013-06-23 13:11:14.000000000 +0200
Karsten Hopp 68ba24
--- src/if_python3.c	2013-06-23 13:25:51.000000000 +0200
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1169,1175 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1169,1175 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1203,1209 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1203,1209 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1285,1291 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1285,1291 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1312,1318 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1312,1318 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1491,1497 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1491,1497 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return NULL;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 1515,1521 ****
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
--- 1515,1521 ----
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
      else
Karsten Hopp 68ba24
      {
Karsten Hopp 68ba24
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
Karsten Hopp 68ba24
  	return -1;
Karsten Hopp 68ba24
      }
Karsten Hopp 68ba24
  }
Karsten Hopp 68ba24
*** ../vim-7.3.1228/src/version.c	2013-06-23 13:11:14.000000000 +0200
Karsten Hopp 68ba24
--- src/version.c	2013-06-23 13:12:35.000000000 +0200
Karsten Hopp 68ba24
***************
Karsten Hopp 68ba24
*** 730,731 ****
Karsten Hopp 68ba24
--- 730,733 ----
Karsten Hopp 68ba24
  {   /* Add new patch number below this line */
Karsten Hopp 68ba24
+ /**/
Karsten Hopp 68ba24
+     1229,
Karsten Hopp 68ba24
  /**/
Karsten Hopp 68ba24
Karsten Hopp 68ba24
-- 
Karsten Hopp 68ba24
There is a fine line between courage and foolishness.
Karsten Hopp 68ba24
Unfortunately, it's not a fence.
Karsten Hopp 68ba24
Karsten Hopp 68ba24
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 68ba24
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 68ba24
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 68ba24
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///