# HG changeset patch
# User ZyX <[email protected]>
# Date 1367209675 -14400
# Branch python-extended-2
# Node ID 14b6c739b0be3839693bf9bfcf9103f4f135a65d
# Parent  3075a07310c74b64b5d55cd5f205ca6e1d690ed5
Transform and clean python exceptions:

- some IndexErrors are normally TypeErrors (things like “key must be integer” is
  TypeError)
- “line number out of range” is IndexError.
- “unable to get option value” is RuntimeError (it should not normally happen)

- Now all PyErr_SetString messages start with lowercase letter and use _().

diff -r 3075a07310c7 -r 14b6c739b0be src/if_py_both.h
--- a/src/if_py_both.h  Mon Apr 29 08:12:43 2013 +0400
+++ b/src/if_py_both.h  Mon Apr 29 08:27:55 2013 +0400
@@ -71,7 +71,8 @@
 {
     if (val == NULL)
     {
-       PyErr_SetString(PyExc_AttributeError, _("can't delete OutputObject 
attributes"));
+       PyErr_SetString(PyExc_AttributeError,
+               _("can't delete OutputObject attributes"));
        return -1;
     }
 
@@ -917,7 +918,7 @@
 
     if (index>=ListLength(self))
     {
-       PyErr_SetString(PyExc_IndexError, "list index out of range");
+       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
        return NULL;
     }
     li = list_find(((ListObject *) (self))->list, (long) index);
@@ -1045,7 +1046,7 @@
     }
     if (index>length || (index==length && obj==NULL))
     {
-       PyErr_SetString(PyExc_IndexError, "list index out of range");
+       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
        return -1;
     }
 
@@ -1184,7 +1185,8 @@
 
     if (val == NULL)
     {
-       PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject 
attributes"));
+       PyErr_SetString(PyExc_AttributeError,
+               _("cannot delete vim.dictionary attributes"));
        return -1;
     }
 
@@ -1192,7 +1194,7 @@
     {
        if (this->list->lv_lock == VAR_FIXED)
        {
-           PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed list"));
+           PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
            return -1;
        }
        else
@@ -1206,7 +1208,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_AttributeError, _("Cannot set this attribute"));
+       PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
        return -1;
     }
 }
@@ -1375,7 +1377,8 @@
            return PyBytes_FromString((char *) stringval);
        else
        {
-           PyErr_SetString(PyExc_ValueError, "Unable to get option value");
+           PyErr_SetString(PyExc_RuntimeError,
+                   _("unable to get option value"));
            return NULL;
        }
     }
@@ -1453,13 +1456,14 @@
     {
        if (this->opt_type == SREQ_GLOBAL)
        {
-           PyErr_SetString(PyExc_ValueError, "Unable to unset global option");
+           PyErr_SetString(PyExc_ValueError,
+                   _("unable to unset global option"));
            return -1;
        }
        else if (!(flags & SOPT_GLOBAL))
        {
-           PyErr_SetString(PyExc_ValueError, "Unable to unset option without "
-                                               "global value");
+           PyErr_SetString(PyExc_ValueError, _("unable to unset option "
+                                               "without global value"));
            return -1;
        }
        else
@@ -1489,7 +1493,7 @@
            val = PyLong_AsLong(valObject);
        else
        {
-           PyErr_SetString(PyExc_ValueError, "Object must be integer");
+           PyErr_SetString(PyExc_TypeError, _("object must be integer"));
            return -1;
        }
 
@@ -1527,7 +1531,7 @@
        }
        else
        {
-           PyErr_SetString(PyExc_ValueError, "Object must be string");
+           PyErr_SetString(PyExc_TypeError, _("object must be string"));
            return -1;
        }
 
@@ -2764,7 +2768,7 @@
 
     if (n < 0 || n > max)
     {
-       PyErr_SetString(PyExc_ValueError, _("line number out of range"));
+       PyErr_SetString(PyExc_IndexError, _("line number out of range"));
        return NULL;
     }
 
@@ -3133,7 +3137,7 @@
        bnr = PyLong_AsLong(keyObject);
     else
     {
-       PyErr_SetString(PyExc_ValueError, _("key must be integer"));
+       PyErr_SetString(PyExc_TypeError, _("key must be integer"));
        return NULL;
     }
 
@@ -3652,7 +3656,8 @@
        return convert_dl(obj, tv, pymap_to_tv, lookupDict);
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("unable to convert to vim 
structure"));
+       PyErr_SetString(PyExc_TypeError,
+               _("unable to convert to vim structure"));
        return -1;
     }
     return 0;
diff -r 3075a07310c7 -r 14b6c739b0be src/if_python.c
--- a/src/if_python.c   Mon Apr 29 08:12:43 2013 +0400
+++ b/src/if_python.c   Mon Apr 29 08:27:55 2013 +0400
@@ -358,6 +358,7 @@
 static PyObject *imp_PyExc_KeyboardInterrupt;
 static PyObject *imp_PyExc_TypeError;
 static PyObject *imp_PyExc_ValueError;
+static PyObject *imp_PyExc_RuntimeError;
 
 # define PyExc_AttributeError imp_PyExc_AttributeError
 # define PyExc_IndexError imp_PyExc_IndexError
@@ -365,6 +366,7 @@
 # define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt
 # define PyExc_TypeError imp_PyExc_TypeError
 # define PyExc_ValueError imp_PyExc_ValueError
+# define PyExc_RuntimeError imp_PyExc_RuntimeError
 
 /*
  * Table of name to function pointer of python.
@@ -593,12 +595,14 @@
     imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, 
"KeyboardInterrupt");
     imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
     imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
+    imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
     Py_XINCREF(imp_PyExc_AttributeError);
     Py_XINCREF(imp_PyExc_IndexError);
     Py_XINCREF(imp_PyExc_KeyError);
     Py_XINCREF(imp_PyExc_KeyboardInterrupt);
     Py_XINCREF(imp_PyExc_TypeError);
     Py_XINCREF(imp_PyExc_ValueError);
+    Py_XINCREF(imp_PyExc_RuntimeError);
     Py_XDECREF(exmod);
 }
 #endif /* DYNAMIC_PYTHON */
diff -r 3075a07310c7 -r 14b6c739b0be src/if_python3.c
--- a/src/if_python3.c  Mon Apr 29 08:12:43 2013 +0400
+++ b/src/if_python3.c  Mon Apr 29 08:27:55 2013 +0400
@@ -336,6 +336,7 @@
 static PyObject *p3imp_PyExc_KeyboardInterrupt;
 static PyObject *p3imp_PyExc_TypeError;
 static PyObject *p3imp_PyExc_ValueError;
+static PyObject *p3imp_PyExc_RuntimeError;
 
 # define PyExc_AttributeError p3imp_PyExc_AttributeError
 # define PyExc_IndexError p3imp_PyExc_IndexError
@@ -343,6 +344,7 @@
 # define PyExc_KeyboardInterrupt p3imp_PyExc_KeyboardInterrupt
 # define PyExc_TypeError p3imp_PyExc_TypeError
 # define PyExc_ValueError p3imp_PyExc_ValueError
+# define PyExc_RuntimeError p3imp_PyExc_RuntimeError
 
 /*
  * Table of name to function pointer of python.
@@ -580,12 +582,14 @@
     p3imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, 
"KeyboardInterrupt");
     p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
     p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
+    p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
     Py_XINCREF(p3imp_PyExc_AttributeError);
     Py_XINCREF(p3imp_PyExc_IndexError);
     Py_XINCREF(p3imp_PyExc_KeyError);
     Py_XINCREF(p3imp_PyExc_KeyboardInterrupt);
     Py_XINCREF(p3imp_PyExc_TypeError);
     Py_XINCREF(p3imp_PyExc_ValueError);
+    Py_XINCREF(p3imp_PyExc_RuntimeError);
     Py_XDECREF(exmod);
 }
 #endif /* DYNAMIC_PYTHON3 */
@@ -1132,7 +1136,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return NULL;
     }
 }
@@ -1166,7 +1170,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return -1;
     }
 }
@@ -1248,7 +1252,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return NULL;
     }
 }
@@ -1275,7 +1279,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return -1;
     }
 }
@@ -1450,7 +1454,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return NULL;
     }
 }
@@ -1474,7 +1478,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
+       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
        return -1;
     }
 }
diff -r 3075a07310c7 -r 14b6c739b0be src/testdir/test86.ok
--- a/src/testdir/test86.ok     Mon Apr 29 08:12:43 2013 +0400
+++ b/src/testdir/test86.ok     Mon Apr 29 08:27:55 2013 +0400
@@ -102,7 +102,7 @@
   B: 1:1 2:1 3:1 4:1
 >>> previewheight
   p/gopts1: 12
-  inv: 'a'! ValueError
+  inv: 'a'! TypeError
   p/wopts1! KeyError
   inv: 'a'! KeyError
   wopts1! KeyError
@@ -123,7 +123,7 @@
   B: 1:5 2:5 3:5 4:5
 >>> operatorfunc
   p/gopts1: ''
-  inv: 2! ValueError
+  inv: 2! TypeError
   p/wopts1! KeyError
   inv: 2! KeyError
   wopts1! KeyError
@@ -198,9 +198,9 @@
   B: 1:'+2' 2:'+3' 3:'+1' 4:''
 >>> statusline
   p/gopts1: ''
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/wopts1: None
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/bopts1! KeyError
   inv: 0! KeyError
   bopts1! KeyError
@@ -259,7 +259,7 @@
   wopts2! KeyError
   wopts3! KeyError
   p/bopts1: ''
-  inv: 1! ValueError
+  inv: 1! TypeError
   G: ''
   W: 1:'A' 2:'B' 3:'' 4:'C'
   B: 1:'A' 2:'B' 3:'' 4:'C'
@@ -288,14 +288,14 @@
   B: 1:0 2:1 3:0 4:1
 >>> path
   p/gopts1: '.,/usr/include,,'
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/wopts1! KeyError
   inv: 0! KeyError
   wopts1! KeyError
   wopts2! KeyError
   wopts3! KeyError
   p/bopts1: None
-  inv: 0! ValueError
+  inv: 0! TypeError
   G: '.,,'
   W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
   B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
diff -r 3075a07310c7 -r 14b6c739b0be src/testdir/test87.ok
--- a/src/testdir/test87.ok     Mon Apr 29 08:12:43 2013 +0400
+++ b/src/testdir/test87.ok     Mon Apr 29 08:27:55 2013 +0400
@@ -91,7 +91,7 @@
   B: 1:1 2:1 3:1 4:1
 >>> previewheight
   p/gopts1: 12
-  inv: 'a'! ValueError
+  inv: 'a'! TypeError
   p/wopts1! KeyError
   inv: 'a'! KeyError
   wopts1! KeyError
@@ -112,7 +112,7 @@
   B: 1:5 2:5 3:5 4:5
 >>> operatorfunc
   p/gopts1: b''
-  inv: 2! ValueError
+  inv: 2! TypeError
   p/wopts1! KeyError
   inv: 2! KeyError
   wopts1! KeyError
@@ -187,9 +187,9 @@
   B: 1:'+2' 2:'+3' 3:'+1' 4:''
 >>> statusline
   p/gopts1: b''
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/wopts1: None
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/bopts1! KeyError
   inv: 0! KeyError
   bopts1! KeyError
@@ -248,7 +248,7 @@
   wopts2! KeyError
   wopts3! KeyError
   p/bopts1: b''
-  inv: 1! ValueError
+  inv: 1! TypeError
   G: ''
   W: 1:'A' 2:'B' 3:'' 4:'C'
   B: 1:'A' 2:'B' 3:'' 4:'C'
@@ -277,14 +277,14 @@
   B: 1:0 2:1 3:0 4:1
 >>> path
   p/gopts1: b'.,/usr/include,,'
-  inv: 0! ValueError
+  inv: 0! TypeError
   p/wopts1! KeyError
   inv: 0! KeyError
   wopts1! KeyError
   wopts2! KeyError
   wopts3! KeyError
   p/bopts1: None
-  inv: 0! ValueError
+  inv: 0! TypeError
   G: '.,,'
   W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
   B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


diff -cr vim.3075a07310c7/src/if_py_both.h vim.14b6c739b0be/src/if_py_both.h
*** vim.3075a07310c7/src/if_py_both.h	2013-05-01 19:10:42.926743843 +0400
--- vim.14b6c739b0be/src/if_py_both.h	2013-05-01 19:10:42.935743754 +0400
***************
*** 71,77 ****
  {
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError, _("can't delete OutputObject attributes"));
  	return -1;
      }
  
--- 71,78 ----
  {
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError,
! 		_("can't delete OutputObject attributes"));
  	return -1;
      }
  
***************
*** 917,923 ****
  
      if (index>=ListLength(self))
      {
! 	PyErr_SetString(PyExc_IndexError, "list index out of range");
  	return NULL;
      }
      li = list_find(((ListObject *) (self))->list, (long) index);
--- 918,924 ----
  
      if (index>=ListLength(self))
      {
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  	return NULL;
      }
      li = list_find(((ListObject *) (self))->list, (long) index);
***************
*** 1045,1051 ****
      }
      if (index>length || (index==length && obj==NULL))
      {
! 	PyErr_SetString(PyExc_IndexError, "list index out of range");
  	return -1;
      }
  
--- 1046,1052 ----
      }
      if (index>length || (index==length && obj==NULL))
      {
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  	return -1;
      }
  
***************
*** 1184,1190 ****
  
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError, _("Cannot delete DictionaryObject attributes"));
  	return -1;
      }
  
--- 1185,1192 ----
  
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError,
! 		_("cannot delete vim.dictionary attributes"));
  	return -1;
      }
  
***************
*** 1192,1198 ****
      {
  	if (this->list->lv_lock == VAR_FIXED)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("Cannot modify fixed list"));
  	    return -1;
  	}
  	else
--- 1194,1200 ----
      {
  	if (this->list->lv_lock == VAR_FIXED)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
  	    return -1;
  	}
  	else
***************
*** 1206,1212 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_AttributeError, _("Cannot set this attribute"));
  	return -1;
      }
  }
--- 1208,1214 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
  	return -1;
      }
  }
***************
*** 1375,1381 ****
  	    return PyBytes_FromString((char *) stringval);
  	else
  	{
! 	    PyErr_SetString(PyExc_ValueError, "Unable to get option value");
  	    return NULL;
  	}
      }
--- 1377,1384 ----
  	    return PyBytes_FromString((char *) stringval);
  	else
  	{
! 	    PyErr_SetString(PyExc_RuntimeError,
! 		    _("unable to get option value"));
  	    return NULL;
  	}
      }
***************
*** 1453,1465 ****
      {
  	if (this->opt_type == SREQ_GLOBAL)
  	{
! 	    PyErr_SetString(PyExc_ValueError, "Unable to unset global option");
  	    return -1;
  	}
  	else if (!(flags & SOPT_GLOBAL))
  	{
! 	    PyErr_SetString(PyExc_ValueError, "Unable to unset option without "
! 						"global value");
  	    return -1;
  	}
  	else
--- 1456,1469 ----
      {
  	if (this->opt_type == SREQ_GLOBAL)
  	{
! 	    PyErr_SetString(PyExc_ValueError,
! 		    _("unable to unset global option"));
  	    return -1;
  	}
  	else if (!(flags & SOPT_GLOBAL))
  	{
! 	    PyErr_SetString(PyExc_ValueError, _("unable to unset option "
! 						"without global value"));
  	    return -1;
  	}
  	else
***************
*** 1489,1495 ****
  	    val = PyLong_AsLong(valObject);
  	else
  	{
! 	    PyErr_SetString(PyExc_ValueError, "Object must be integer");
  	    return -1;
  	}
  
--- 1493,1499 ----
  	    val = PyLong_AsLong(valObject);
  	else
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("object must be integer"));
  	    return -1;
  	}
  
***************
*** 1527,1533 ****
  	}
  	else
  	{
! 	    PyErr_SetString(PyExc_ValueError, "Object must be string");
  	    return -1;
  	}
  
--- 1531,1537 ----
  	}
  	else
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("object must be string"));
  	    return -1;
  	}
  
***************
*** 2764,2770 ****
  
      if (n < 0 || n > max)
      {
! 	PyErr_SetString(PyExc_ValueError, _("line number out of range"));
  	return NULL;
      }
  
--- 2768,2774 ----
  
      if (n < 0 || n > max)
      {
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
  	return NULL;
      }
  
***************
*** 3133,3139 ****
  	bnr = PyLong_AsLong(keyObject);
      else
      {
! 	PyErr_SetString(PyExc_ValueError, _("key must be integer"));
  	return NULL;
      }
  
--- 3137,3143 ----
  	bnr = PyLong_AsLong(keyObject);
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("key must be integer"));
  	return NULL;
      }
  
***************
*** 3652,3658 ****
  	return convert_dl(obj, tv, pymap_to_tv, lookupDict);
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("unable to convert to vim structure"));
  	return -1;
      }
      return 0;
--- 3656,3663 ----
  	return convert_dl(obj, tv, pymap_to_tv, lookupDict);
      else
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("unable to convert to vim structure"));
  	return -1;
      }
      return 0;
diff -cr vim.3075a07310c7/src/if_python3.c vim.14b6c739b0be/src/if_python3.c
*** vim.3075a07310c7/src/if_python3.c	2013-05-01 19:10:42.923743872 +0400
--- vim.14b6c739b0be/src/if_python3.c	2013-05-01 19:10:42.933743773 +0400
***************
*** 336,341 ****
--- 336,342 ----
  static PyObject *p3imp_PyExc_KeyboardInterrupt;
  static PyObject *p3imp_PyExc_TypeError;
  static PyObject *p3imp_PyExc_ValueError;
+ static PyObject *p3imp_PyExc_RuntimeError;
  
  # define PyExc_AttributeError p3imp_PyExc_AttributeError
  # define PyExc_IndexError p3imp_PyExc_IndexError
***************
*** 343,348 ****
--- 344,350 ----
  # define PyExc_KeyboardInterrupt p3imp_PyExc_KeyboardInterrupt
  # define PyExc_TypeError p3imp_PyExc_TypeError
  # define PyExc_ValueError p3imp_PyExc_ValueError
+ # define PyExc_RuntimeError p3imp_PyExc_RuntimeError
  
  /*
   * Table of name to function pointer of python.
***************
*** 580,591 ****
--- 582,595 ----
      p3imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
      p3imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
      p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
+     p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
      Py_XINCREF(p3imp_PyExc_AttributeError);
      Py_XINCREF(p3imp_PyExc_IndexError);
      Py_XINCREF(p3imp_PyExc_KeyError);
      Py_XINCREF(p3imp_PyExc_KeyboardInterrupt);
      Py_XINCREF(p3imp_PyExc_TypeError);
      Py_XINCREF(p3imp_PyExc_ValueError);
+     Py_XINCREF(p3imp_PyExc_RuntimeError);
      Py_XDECREF(exmod);
  }
  #endif /* DYNAMIC_PYTHON3 */
***************
*** 1132,1138 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return NULL;
      }
  }
--- 1136,1142 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
***************
*** 1166,1172 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return -1;
      }
  }
--- 1170,1176 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
***************
*** 1248,1254 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return NULL;
      }
  }
--- 1252,1258 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
***************
*** 1275,1281 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return -1;
      }
  }
--- 1279,1285 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
***************
*** 1450,1456 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return NULL;
      }
  }
--- 1454,1460 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
***************
*** 1474,1480 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_IndexError, "Index must be int or slice");
  	return -1;
      }
  }
--- 1478,1484 ----
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
diff -cr vim.3075a07310c7/src/if_python.c vim.14b6c739b0be/src/if_python.c
*** vim.3075a07310c7/src/if_python.c	2013-05-01 19:10:42.928743823 +0400
--- vim.14b6c739b0be/src/if_python.c	2013-05-01 19:10:42.938743725 +0400
***************
*** 358,363 ****
--- 358,364 ----
  static PyObject *imp_PyExc_KeyboardInterrupt;
  static PyObject *imp_PyExc_TypeError;
  static PyObject *imp_PyExc_ValueError;
+ static PyObject *imp_PyExc_RuntimeError;
  
  # define PyExc_AttributeError imp_PyExc_AttributeError
  # define PyExc_IndexError imp_PyExc_IndexError
***************
*** 365,370 ****
--- 366,372 ----
  # define PyExc_KeyboardInterrupt imp_PyExc_KeyboardInterrupt
  # define PyExc_TypeError imp_PyExc_TypeError
  # define PyExc_ValueError imp_PyExc_ValueError
+ # define PyExc_RuntimeError imp_PyExc_RuntimeError
  
  /*
   * Table of name to function pointer of python.
***************
*** 593,604 ****
--- 595,608 ----
      imp_PyExc_KeyboardInterrupt = PyDict_GetItemString(exdict, "KeyboardInterrupt");
      imp_PyExc_TypeError = PyDict_GetItemString(exdict, "TypeError");
      imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError");
+     imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError");
      Py_XINCREF(imp_PyExc_AttributeError);
      Py_XINCREF(imp_PyExc_IndexError);
      Py_XINCREF(imp_PyExc_KeyError);
      Py_XINCREF(imp_PyExc_KeyboardInterrupt);
      Py_XINCREF(imp_PyExc_TypeError);
      Py_XINCREF(imp_PyExc_ValueError);
+     Py_XINCREF(imp_PyExc_RuntimeError);
      Py_XDECREF(exmod);
  }
  #endif /* DYNAMIC_PYTHON */
diff -cr vim.3075a07310c7/src/testdir/test86.ok vim.14b6c739b0be/src/testdir/test86.ok
*** vim.3075a07310c7/src/testdir/test86.ok	2013-05-01 19:10:42.921743892 +0400
--- vim.14b6c739b0be/src/testdir/test86.ok	2013-05-01 19:10:42.931743794 +0400
***************
*** 102,108 ****
    B: 1:1 2:1 3:1 4:1
  >>> previewheight
    p/gopts1: 12
!   inv: 'a'! ValueError
    p/wopts1! KeyError
    inv: 'a'! KeyError
    wopts1! KeyError
--- 102,108 ----
    B: 1:1 2:1 3:1 4:1
  >>> previewheight
    p/gopts1: 12
!   inv: 'a'! TypeError
    p/wopts1! KeyError
    inv: 'a'! KeyError
    wopts1! KeyError
***************
*** 123,129 ****
    B: 1:5 2:5 3:5 4:5
  >>> operatorfunc
    p/gopts1: ''
!   inv: 2! ValueError
    p/wopts1! KeyError
    inv: 2! KeyError
    wopts1! KeyError
--- 123,129 ----
    B: 1:5 2:5 3:5 4:5
  >>> operatorfunc
    p/gopts1: ''
!   inv: 2! TypeError
    p/wopts1! KeyError
    inv: 2! KeyError
    wopts1! KeyError
***************
*** 198,206 ****
    B: 1:'+2' 2:'+3' 3:'+1' 4:''
  >>> statusline
    p/gopts1: ''
!   inv: 0! ValueError
    p/wopts1: None
!   inv: 0! ValueError
    p/bopts1! KeyError
    inv: 0! KeyError
    bopts1! KeyError
--- 198,206 ----
    B: 1:'+2' 2:'+3' 3:'+1' 4:''
  >>> statusline
    p/gopts1: ''
!   inv: 0! TypeError
    p/wopts1: None
!   inv: 0! TypeError
    p/bopts1! KeyError
    inv: 0! KeyError
    bopts1! KeyError
***************
*** 259,265 ****
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: ''
!   inv: 1! ValueError
    G: ''
    W: 1:'A' 2:'B' 3:'' 4:'C'
    B: 1:'A' 2:'B' 3:'' 4:'C'
--- 259,265 ----
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: ''
!   inv: 1! TypeError
    G: ''
    W: 1:'A' 2:'B' 3:'' 4:'C'
    B: 1:'A' 2:'B' 3:'' 4:'C'
***************
*** 288,301 ****
    B: 1:0 2:1 3:0 4:1
  >>> path
    p/gopts1: '.,/usr/include,,'
!   inv: 0! ValueError
    p/wopts1! KeyError
    inv: 0! KeyError
    wopts1! KeyError
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: None
!   inv: 0! ValueError
    G: '.,,'
    W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
    B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
--- 288,301 ----
    B: 1:0 2:1 3:0 4:1
  >>> path
    p/gopts1: '.,/usr/include,,'
!   inv: 0! TypeError
    p/wopts1! KeyError
    inv: 0! KeyError
    wopts1! KeyError
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: None
!   inv: 0! TypeError
    G: '.,,'
    W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
    B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
diff -cr vim.3075a07310c7/src/testdir/test87.ok vim.14b6c739b0be/src/testdir/test87.ok
*** vim.3075a07310c7/src/testdir/test87.ok	2013-05-01 19:10:42.921743892 +0400
--- vim.14b6c739b0be/src/testdir/test87.ok	2013-05-01 19:10:42.931743794 +0400
***************
*** 91,97 ****
    B: 1:1 2:1 3:1 4:1
  >>> previewheight
    p/gopts1: 12
!   inv: 'a'! ValueError
    p/wopts1! KeyError
    inv: 'a'! KeyError
    wopts1! KeyError
--- 91,97 ----
    B: 1:1 2:1 3:1 4:1
  >>> previewheight
    p/gopts1: 12
!   inv: 'a'! TypeError
    p/wopts1! KeyError
    inv: 'a'! KeyError
    wopts1! KeyError
***************
*** 112,118 ****
    B: 1:5 2:5 3:5 4:5
  >>> operatorfunc
    p/gopts1: b''
!   inv: 2! ValueError
    p/wopts1! KeyError
    inv: 2! KeyError
    wopts1! KeyError
--- 112,118 ----
    B: 1:5 2:5 3:5 4:5
  >>> operatorfunc
    p/gopts1: b''
!   inv: 2! TypeError
    p/wopts1! KeyError
    inv: 2! KeyError
    wopts1! KeyError
***************
*** 187,195 ****
    B: 1:'+2' 2:'+3' 3:'+1' 4:''
  >>> statusline
    p/gopts1: b''
!   inv: 0! ValueError
    p/wopts1: None
!   inv: 0! ValueError
    p/bopts1! KeyError
    inv: 0! KeyError
    bopts1! KeyError
--- 187,195 ----
    B: 1:'+2' 2:'+3' 3:'+1' 4:''
  >>> statusline
    p/gopts1: b''
!   inv: 0! TypeError
    p/wopts1: None
!   inv: 0! TypeError
    p/bopts1! KeyError
    inv: 0! KeyError
    bopts1! KeyError
***************
*** 248,254 ****
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: b''
!   inv: 1! ValueError
    G: ''
    W: 1:'A' 2:'B' 3:'' 4:'C'
    B: 1:'A' 2:'B' 3:'' 4:'C'
--- 248,254 ----
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: b''
!   inv: 1! TypeError
    G: ''
    W: 1:'A' 2:'B' 3:'' 4:'C'
    B: 1:'A' 2:'B' 3:'' 4:'C'
***************
*** 277,290 ****
    B: 1:0 2:1 3:0 4:1
  >>> path
    p/gopts1: b'.,/usr/include,,'
!   inv: 0! ValueError
    p/wopts1! KeyError
    inv: 0! KeyError
    wopts1! KeyError
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: None
!   inv: 0! ValueError
    G: '.,,'
    W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
    B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
--- 277,290 ----
    B: 1:0 2:1 3:0 4:1
  >>> path
    p/gopts1: b'.,/usr/include,,'
!   inv: 0! TypeError
    p/wopts1! KeyError
    inv: 0! KeyError
    wopts1! KeyError
    wopts2! KeyError
    wopts3! KeyError
    p/bopts1: None
!   inv: 0! TypeError
    G: '.,,'
    W: 1:'.,,' 2:',,' 3:'.,,' 4:'.'
    B: 1:'.,,' 2:',,' 3:'.,,' 4:'.'

Raspunde prin e-mail lui