# HG changeset patch
# User ZyX <[email protected]>
# Date 1371238936 -14400
#      Fri Jun 14 23:42:16 2013 +0400
# Branch python-fixes
# Node ID abcf5d9458ee826516c1051cfd14d279b1097174
# Parent  b9d4dfa09951d4fb75972df34802675edf24a17e
Make macros do translation of exception messages

Reason: it will be easy to delete/restore translating

diff -r b9d4dfa09951 -r abcf5d9458ee src/if_py_both.h
--- a/src/if_py_both.h  Fri Jun 14 19:27:27 2013 +0400
+++ b/src/if_py_both.h  Fri Jun 14 23:42:16 2013 +0400
@@ -26,10 +26,12 @@
 
 static const char *vim_special_path = "_vim_path_";
 
+#define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
 #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
-
-#define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
-                                               _("empty keys are not allowed"))
+#define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
+
+#define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \
+                                               "empty keys are not allowed")
 
 #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
 #define INVALID_WINDOW_VALUE ((win_T *)(-1))
@@ -120,7 +122,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("object must be string"));
+       PyErr_SET_STRING(PyExc_TypeError, "object must be string");
        return NULL;
     }
 
@@ -212,8 +214,8 @@
 {
     if (val == NULL)
     {
-       PyErr_SetString(PyExc_AttributeError,
-               _("can't delete OutputObject attributes"));
+       PyErr_SET_STRING(PyExc_AttributeError,
+               "can't delete OutputObject attributes");
        return -1;
     }
 
@@ -221,7 +223,7 @@
     {
        if (!PyInt_Check(val))
        {
-           PyErr_SetString(PyExc_TypeError, _("softspace must be an integer"));
+           PyErr_SET_STRING(PyExc_TypeError, "softspace must be an integer");
            return -1;
        }
 
@@ -229,7 +231,7 @@
        return 0;
     }
 
-    PyErr_SetString(PyExc_AttributeError, _("invalid attribute"));
+    PyErr_SET_STRING(PyExc_AttributeError, "invalid attribute");
     return -1;
 }
 
@@ -668,7 +670,7 @@
 
     if (our_tv == NULL)
     {
-       PyErr_SetVim(_("invalid expression"));
+       PyErr_SET_VIM("invalid expression");
        return NULL;
     }
 
@@ -719,7 +721,7 @@
 
     if (our_tv == NULL)
     {
-       PyErr_SetVim(_("invalid expression"));
+       PyErr_SET_VIM("invalid expression");
        return NULL;
     }
 
@@ -791,7 +793,7 @@
        if (VimTryEnd())
            return NULL;
 
-       PyErr_SetVim(_("failed to change directory"));
+       PyErr_SET_VIM("failed to change directory");
        return NULL;
     }
 
@@ -969,8 +971,8 @@
     if (!PyTuple_Check(find_module_result)
            || PyTuple_GET_SIZE(find_module_result) != 3)
     {
-       PyErr_SetString(PyExc_TypeError,
-               _("expected 3-tuple as imp.find_module() result"));
+       PyErr_SET_STRING(PyExc_TypeError,
+               "expected 3-tuple as imp.find_module() result");
        return NULL;
     }
 
@@ -978,8 +980,8 @@
            || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
            || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
     {
-       PyErr_SetString(PyExc_RuntimeError,
-               _("internal error: imp.find_module returned tuple with NULL"));
+       PyErr_SET_STRING(PyExc_RuntimeError,
+               "internal error: imp.find_module returned tuple with NULL");
        return NULL;
     }
 
@@ -1350,8 +1352,8 @@
 {
     if (val == NULL)
     {
-       PyErr_SetString(PyExc_AttributeError,
-               _("cannot delete vim.Dictionary attributes"));
+       PyErr_SET_STRING(PyExc_AttributeError,
+               "cannot delete vim.Dictionary attributes");
        return -1;
     }
 
@@ -1359,7 +1361,7 @@
     {
        if (self->dict->dv_lock == VAR_FIXED)
        {
-           PyErr_SetString(PyExc_TypeError, _("cannot modify fixed 
dictionary"));
+           PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed dictionary");
            return -1;
        }
        else
@@ -1376,7 +1378,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
+       PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
        return -1;
     }
 }
@@ -1458,7 +1460,7 @@
     {
        if (dict->dv_lock)
        {
-           PyErr_SetVim(_("dict is locked"));
+           PyErr_SET_VIM("dict is locked");
            Py_DECREF(r);
            return NULL;
        }
@@ -1509,8 +1511,8 @@
     if ((*dii)->ht->ht_array != (*dii)->ht_array ||
            (*dii)->ht->ht_used != (*dii)->ht_used)
     {
-       PyErr_SetString(PyExc_RuntimeError,
-               _("hashtab changed during iteration"));
+       PyErr_SET_STRING(PyExc_RuntimeError,
+               "hashtab changed during iteration");
        return NULL;
     }
 
@@ -1561,7 +1563,7 @@
 
     if (dict->dv_lock)
     {
-       PyErr_SetVim(_("dict is locked"));
+       PyErr_SET_VIM("dict is locked");
        return -1;
     }
 
@@ -1616,7 +1618,7 @@
            Py_XDECREF(todecref);
            vim_free(di);
            dictitem_free(di);
-           PyErr_SetVim(_("failed to add key to dictionary"));
+           PyErr_SET_VIM("failed to add key to dictionary");
            return -1;
        }
     }
@@ -1724,7 +1726,7 @@
 
     if (dict->dv_lock)
     {
-       PyErr_SetVim(_("dict is locked"));
+       PyErr_SET_VIM("dict is locked");
        return NULL;
     }
 
@@ -1780,8 +1782,8 @@
                {
                    Py_DECREF(iterator);
                    Py_DECREF(fast);
-                   PyErr_SetString(PyExc_ValueError,
-                           _("expected sequence element of size 2"));
+                   PyErr_SET_STRING(PyExc_ValueError,
+                           "expected sequence element of size 2");
                    return NULL;
                }
 
@@ -1824,7 +1826,7 @@
                {
                    Py_DECREF(iterator);
                    dictitem_free(di);
-                   PyErr_SetVim(_("failed to add key to dictionary"));
+                   PyErr_SET_VIM("failed to add key to dictionary");
                    return NULL;
                }
            }
@@ -2022,8 +2024,8 @@
 
     if (kwargs)
     {
-       PyErr_SetString(PyExc_TypeError,
-               _("list constructor does not accept keyword arguments"));
+       PyErr_SET_STRING(PyExc_TypeError,
+               "list constructor does not accept keyword arguments");
        return NULL;
     }
 
@@ -2078,13 +2080,13 @@
 
     if (index >= ListLength(self))
     {
-       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
+       PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
        return NULL;
     }
     li = list_find(self->list, (long) index);
     if (li == NULL)
     {
-       PyErr_SetVim(_("internal error: failed to get vim list item"));
+       PyErr_SET_VIM("internal error: failed to get vim list item");
        return NULL;
     }
     return ConvertToPyObject(&li->li_tv);
@@ -2197,12 +2199,12 @@
 
     if (l->lv_lock)
     {
-       PyErr_SetVim(_("list is locked"));
+       PyErr_SET_VIM("list is locked");
        return -1;
     }
     if (index>length || (index==length && obj==NULL))
     {
-       PyErr_SetString(PyExc_IndexError, _("list index out of range"));
+       PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
        return -1;
     }
 
@@ -2223,7 +2225,7 @@
        if (list_append_tv(l, &tv) == FAIL)
        {
            clear_tv(&tv);
-           PyErr_SetVim(_("failed to add item to list"));
+           PyErr_SET_VIM("failed to add item to list");
            return -1;
        }
     }
@@ -2251,7 +2253,7 @@
 
     if (l->lv_lock)
     {
-       PyErr_SetVim(_("list is locked"));
+       PyErr_SET_VIM("list is locked");
        return -1;
     }
 
@@ -2264,7 +2266,7 @@
        li = list_find(l, (long) first);
        if (li == NULL)
        {
-           PyErr_SetVim(_("internal error: no vim list item"));
+           PyErr_SET_VIM("internal error: no vim list item");
            return -1;
        }
        if (last > first)
@@ -2297,7 +2299,7 @@
        if (list_insert_tv(l, &v, li) == FAIL)
        {
            clear_tv(&v);
-           PyErr_SetVim(_("internal error: failed to add item to list"));
+           PyErr_SET_VIM("internal error: failed to add item to list");
            return -1;
        }
        clear_tv(&v);
@@ -2314,7 +2316,7 @@
 
     if (l->lv_lock)
     {
-       PyErr_SetVim(_("list is locked"));
+       PyErr_SET_VIM("list is locked");
        return NULL;
     }
 
@@ -2348,8 +2350,8 @@
 {
     if (val == NULL)
     {
-       PyErr_SetString(PyExc_AttributeError,
-               _("cannot delete vim.List attributes"));
+       PyErr_SET_STRING(PyExc_AttributeError,
+               "cannot delete vim.List attributes");
        return -1;
     }
 
@@ -2357,7 +2359,7 @@
     {
        if (self->list->lv_lock == VAR_FIXED)
        {
-           PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
+           PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed list");
            return -1;
        }
        else
@@ -2374,7 +2376,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
+       PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
        return -1;
     }
 }
@@ -2409,8 +2411,8 @@
     {
        if (!translated_function_exists(name))
        {
-           PyErr_SetString(PyExc_ValueError,
-                   _("unnamed function does not exist"));
+           PyErr_SET_STRING(PyExc_ValueError,
+                   "unnamed function does not exist");
            return NULL;
        }
        self->name = vim_strsave(name);
@@ -2421,7 +2423,7 @@
                                    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
                == NULL)
        {
-           PyErr_SetString(PyExc_ValueError, _("function does not exist"));
+           PyErr_SET_STRING(PyExc_ValueError, "function does not exist");
            return NULL;
        }
 
@@ -2436,8 +2438,8 @@
 
     if (kwargs)
     {
-       PyErr_SetString(PyExc_TypeError,
-               _("function constructor does not accept keyword arguments"));
+       PyErr_SET_STRING(PyExc_TypeError,
+               "function constructor does not accept keyword arguments");
        return NULL;
     }
 
@@ -2514,7 +2516,7 @@
     else if (error != OK)
     {
        result = NULL;
-       PyErr_SetVim(_("failed to run function"));
+       PyErr_SET_VIM("failed to run function");
     }
     else
        result = ConvertToPyObject(&rettv);
@@ -2659,14 +2661,14 @@
        }
        else
        {
-           PyErr_SetString(PyExc_RuntimeError,
-                   _("unable to get option value"));
+           PyErr_SET_STRING(PyExc_RuntimeError,
+                   "unable to get option value");
            return NULL;
        }
     }
     else
     {
-       PyErr_SetVim("Internal error: unknown option type. Should not happen");
+       PyErr_SET_VIM("internal error: unknown option type");
        return NULL;
     }
 }
@@ -2709,7 +2711,7 @@
            {
                if (VimTryEnd())
                    return -1;
-               PyErr_SetVim("Problem while switching windows.");
+               PyErr_SET_VIM("problem while switching windows");
                return -1;
            }
            r = set_option_value_err(key, numval, stringval, opt_flags);
@@ -2769,15 +2771,14 @@
     {
        if (self->opt_type == SREQ_GLOBAL)
        {
-           PyErr_SetString(PyExc_ValueError,
-                   _("unable to unset global option"));
+           PyErr_SET_STRING(PyExc_ValueError, "unable to unset global option");
            Py_XDECREF(todecref);
            return -1;
        }
        else if (!(flags & SOPT_GLOBAL))
        {
-           PyErr_SetString(PyExc_ValueError, _("unable to unset option "
-                                               "without global value"));
+           PyErr_SET_STRING(PyExc_ValueError, "unable to unset option "
+                                              "without global value");
            Py_XDECREF(todecref);
            return -1;
        }
@@ -2814,7 +2815,7 @@
            val = PyLong_AsLong(valObject);
        else
        {
-           PyErr_SetString(PyExc_TypeError, _("object must be integer"));
+           PyErr_SET_STRING(PyExc_TypeError, "object must be integer");
            Py_XDECREF(todecref);
            return -1;
        }
@@ -2863,7 +2864,7 @@
 {
     if (self->tab == INVALID_TABPAGE_VALUE)
     {
-       PyErr_SetVim(_("attempt to refer to deleted tab page"));
+       PyErr_SET_VIM("attempt to refer to deleted tab page");
        return -1;
     }
 
@@ -3007,7 +3008,7 @@
        if (n == 0)
            return TabPageNew(tp);
 
-    PyErr_SetString(PyExc_IndexError, _("no such tab page"));
+    PyErr_SET_STRING(PyExc_IndexError, "no such tab page");
     return NULL;
 }
 
@@ -3028,7 +3029,7 @@
 {
     if (self->win == INVALID_WINDOW_VALUE)
     {
-       PyErr_SetVim(_("attempt to refer to deleted window"));
+       PyErr_SET_VIM("attempt to refer to deleted window");
        return -1;
     }
 
@@ -3194,7 +3195,7 @@
 
     if (strcmp(name, "buffer") == 0)
     {
-       PyErr_SetString(PyExc_TypeError, _("readonly attribute"));
+       PyErr_SET_STRING(PyExc_TypeError, "readonly attribute");
        return -1;
     }
     else if (strcmp(name, "cursor") == 0)
@@ -3207,7 +3208,7 @@
 
        if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
        {
-           PyErr_SetVim(_("cursor position outside buffer"));
+           PyErr_SET_VIM("cursor position outside buffer");
            return -1;
        }
 
@@ -3370,7 +3371,7 @@
        if (n == 0)
            return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
 
-    PyErr_SetString(PyExc_IndexError, _("no such window"));
+    PyErr_SET_STRING(PyExc_IndexError, "no such window");
     return NULL;
 }
 
@@ -3424,7 +3425,7 @@
            --len;
        else
        {
-           PyErr_SetVim(_("string cannot contain newlines"));
+           PyErr_SET_VIM("string cannot contain newlines");
            return NULL;
        }
     }
@@ -3557,9 +3558,9 @@
        VimTryStart();
 
        if (u_savedel((linenr_T)n, 1L) == FAIL)
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
        else if (ml_delete((linenr_T)n, FALSE) == FAIL)
-           PyErr_SetVim(_("cannot delete line"));
+           PyErr_SET_VIM("cannot delete line");
        else
        {
            if (buf == savebuf)
@@ -3593,12 +3594,12 @@
 
        if (u_savesub((linenr_T)n) == FAIL)
        {
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
            vim_free(save);
        }
        else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
        {
-           PyErr_SetVim(_("cannot replace line"));
+           PyErr_SET_VIM("cannot replace line");
            vim_free(save);
        }
        else
@@ -3653,14 +3654,14 @@
        switch_buffer(&savebuf, buf);
 
        if (u_savedel((linenr_T)lo, (long)n) == FAIL)
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
        else
        {
            for (i = 0; i < n; ++i)
            {
                if (ml_delete((linenr_T)lo, FALSE) == FAIL)
                {
-                   PyErr_SetVim(_("cannot delete line"));
+                   PyErr_SET_VIM("cannot delete line");
                    break;
                }
            }
@@ -3721,7 +3722,7 @@
        switch_buffer(&savebuf, buf);
 
        if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
 
        /* If the size of the range is reducing (ie, new_len < old_len) we
         * need to delete some old_len. We do this at the start, by
@@ -3732,7 +3733,7 @@
            for (i = 0; i < old_len - new_len; ++i)
                if (ml_delete((linenr_T)lo, FALSE) == FAIL)
                {
-                   PyErr_SetVim(_("cannot delete line"));
+                   PyErr_SET_VIM("cannot delete line");
                    break;
                }
            extra -= i;
@@ -3748,7 +3749,7 @@
                if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
                                                                      == FAIL)
                {
-                   PyErr_SetVim(_("cannot replace line"));
+                   PyErr_SET_VIM("cannot replace line");
                    break;
                }
        }
@@ -3766,7 +3767,7 @@
                if (ml_append((linenr_T)(lo + i - 1),
                                        (char_u *)array[i], 0, FALSE) == FAIL)
                {
-                   PyErr_SetVim(_("cannot insert line"));
+                   PyErr_SET_VIM("cannot insert line");
                    break;
                }
                vim_free(array[i]);
@@ -3843,9 +3844,9 @@
        switch_buffer(&savebuf, buf);
 
        if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
        else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
-           PyErr_SetVim(_("cannot insert line"));
+           PyErr_SET_VIM("cannot insert line");
        else
            appended_lines_mark((linenr_T)n, 1L);
 
@@ -3894,7 +3895,7 @@
        switch_buffer(&savebuf, buf);
 
        if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
-           PyErr_SetVim(_("cannot save undo information"));
+           PyErr_SET_VIM("cannot save undo information");
        else
        {
            for (i = 0; i < size; ++i)
@@ -3902,7 +3903,7 @@
                if (ml_append((linenr_T)(n + i),
                                        (char_u *)array[i], 0, FALSE) == FAIL)
                {
-                   PyErr_SetVim(_("cannot insert line"));
+                   PyErr_SET_VIM("cannot insert line");
 
                    /* Free the rest of the lines */
                    while (i < size)
@@ -3955,7 +3956,7 @@
 {
     if (self->buf == INVALID_BUFFER_VALUE)
     {
-       PyErr_SetVim(_("attempt to refer to deleted buffer"));
+       PyErr_SET_VIM("attempt to refer to deleted buffer");
        return -1;
     }
 
@@ -3976,7 +3977,7 @@
 
     if (n < 0 || n > end - start)
     {
-       PyErr_SetString(PyExc_IndexError, _("line number out of range"));
+       PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
        return NULL;
     }
 
@@ -4026,7 +4027,7 @@
 
     if (n < 0 || n > end - start)
     {
-       PyErr_SetString(PyExc_IndexError, _("line number out of range"));
+       PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
        return -1;
     }
 
@@ -4098,7 +4099,7 @@
 
     if (n < 0 || n > max)
     {
-       PyErr_SetString(PyExc_IndexError, _("line number out of range"));
+       PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
        return NULL;
     }
 
@@ -4381,7 +4382,7 @@
 
        if (r == FAIL)
        {
-           PyErr_SetVim(_("failed to rename buffer"));
+           PyErr_SET_VIM("failed to rename buffer");
            return -1;
        }
        return 0;
@@ -4416,8 +4417,8 @@
 
     if (pmark[0] == '\0' || pmark[1] != '\0')
     {
-       PyErr_SetString(PyExc_ValueError,
-               _("mark name must be a single character"));
+       PyErr_SET_STRING(PyExc_ValueError,
+               "mark name must be a single character");
        return NULL;
     }
 
@@ -4434,7 +4435,7 @@
 
     if (posp == NULL)
     {
-       PyErr_SetVim(_("invalid mark name"));
+       PyErr_SET_VIM("invalid mark name");
        return NULL;
     }
 
@@ -4529,7 +4530,7 @@
        bnr = PyLong_AsLong(keyObject);
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("key must be integer"));
+       PyErr_SET_STRING(PyExc_TypeError, "key must be integer");
        return NULL;
     }
 
@@ -4667,7 +4668,7 @@
 
        if (value->ob_type != &BufferType)
        {
-           PyErr_SetString(PyExc_TypeError, _("expected vim.Buffer object"));
+           PyErr_SET_STRING(PyExc_TypeError, "expected vim.Buffer object");
            return -1;
        }
 
@@ -4680,7 +4681,7 @@
        {
            if (VimTryEnd())
                return -1;
-           PyErr_SetVim(_("failed to switch to given buffer"));
+           PyErr_SET_VIM("failed to switch to given buffer");
            return -1;
        }
 
@@ -4692,7 +4693,7 @@
 
        if (value->ob_type != &WindowType)
        {
-           PyErr_SetString(PyExc_TypeError, _("expected vim.Window object"));
+           PyErr_SET_STRING(PyExc_TypeError, "expected vim.Window object");
            return -1;
        }
 
@@ -4702,8 +4703,8 @@
 
        if (!count)
        {
-           PyErr_SetString(PyExc_ValueError,
-                   _("failed to find window in the current tab page"));
+           PyErr_SET_STRING(PyExc_ValueError,
+                   "failed to find window in the current tab page");
            return -1;
        }
 
@@ -4713,8 +4714,8 @@
        {
            if (VimTryEnd())
                return -1;
-           PyErr_SetString(PyExc_RuntimeError,
-                   _("did not switch to the specified window"));
+           PyErr_SET_STRING(PyExc_RuntimeError,
+                   "did not switch to the specified window");
            return -1;
        }
 
@@ -4724,7 +4725,7 @@
     {
        if (value->ob_type != &TabPageType)
        {
-           PyErr_SetString(PyExc_TypeError, _("expected vim.TabPage object"));
+           PyErr_SET_STRING(PyExc_TypeError, "expected vim.TabPage object");
            return -1;
        }
 
@@ -4737,8 +4738,8 @@
        {
            if (VimTryEnd())
                return -1;
-           PyErr_SetString(PyExc_RuntimeError,
-                   _("did not switch to the specified tab page"));
+           PyErr_SET_STRING(PyExc_RuntimeError,
+                   "did not switch to the specified tab page");
            return -1;
        }
 
@@ -5005,7 +5006,7 @@
            clear_tv(&di->di_tv);
            vim_free(di);
            dict_unref(dict);
-           PyErr_SetVim(_("failed to add key to dictionary"));
+           PyErr_SET_VIM("failed to add key to dictionary");
            return -1;
        }
     }
@@ -5107,7 +5108,7 @@
            Py_DECREF(iterator);
            dictitem_free(di);
            dict_unref(dict);
-           PyErr_SetVim(_("failed to add key to dictionary"));
+           PyErr_SET_VIM("failed to add key to dictionary");
            return -1;
        }
     }
@@ -5215,8 +5216,8 @@
        r = convert_dl(obj, tv, pymap_to_tv, lookup_dict);
     else
     {
-       PyErr_SetString(PyExc_TypeError,
-               _("unable to convert object to vim dictionary"));
+       PyErr_SET_STRING(PyExc_TypeError,
+               "unable to convert object to vim dictionary");
        r = -1;
     }
     Py_DECREF(lookup_dict);
@@ -5325,8 +5326,8 @@
        return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
     else
     {
-       PyErr_SetString(PyExc_TypeError,
-               _("unable to convert to vim structure"));
+       PyErr_SET_STRING(PyExc_TypeError,
+               "unable to convert to vim structure");
        return -1;
     }
     return 0;
@@ -5337,7 +5338,7 @@
 {
     if (tv == NULL)
     {
-       PyErr_SetVim(_("NULL reference passed"));
+       PyErr_SET_VIM("NULL reference passed");
        return NULL;
     }
     switch (tv->v_type)
@@ -5362,7 +5363,7 @@
            Py_INCREF(Py_None);
            return Py_None;
        default:
-           PyErr_SetVim(_("internal error: invalid value type"));
+           PyErr_SET_VIM("internal error: invalid value type");
            return NULL;
     }
 }
diff -r b9d4dfa09951 -r abcf5d9458ee src/if_python3.c
--- a/src/if_python3.c  Fri Jun 14 19:27:27 2013 +0400
+++ b/src/if_python3.c  Fri Jun 14 23:42:16 2013 +0400
@@ -1169,7 +1169,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return NULL;
     }
 }
@@ -1203,7 +1203,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return -1;
     }
 }
@@ -1285,7 +1285,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return NULL;
     }
 }
@@ -1312,7 +1312,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return -1;
     }
 }
@@ -1491,7 +1491,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return NULL;
     }
 }
@@ -1515,7 +1515,7 @@
     }
     else
     {
-       PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
+       PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
        return -1;
     }
 }

-- 
-- 
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 -crN vim.b9d4dfa09951/src/if_py_both.h vim.abcf5d9458ee/src/if_py_both.h
*** vim.b9d4dfa09951/src/if_py_both.h	2013-06-16 19:25:54.804645292 +0400
--- vim.abcf5d9458ee/src/if_py_both.h	2013-06-16 19:25:54.816645177 +0400
***************
*** 26,35 ****
  
  static const char *vim_special_path = "_vim_path_";
  
  #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
  
! #define RAISE_NO_EMPTY_KEYS PyErr_SetString(PyExc_ValueError, \
! 						_("empty keys are not allowed"))
  
  #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
  #define INVALID_WINDOW_VALUE ((win_T *)(-1))
--- 26,37 ----
  
  static const char *vim_special_path = "_vim_path_";
  
+ #define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str))
  #define PyErr_SetVim(str) PyErr_SetString(VimError, str)
+ #define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str)
  
! #define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \
! 						"empty keys are not allowed")
  
  #define INVALID_BUFFER_VALUE ((buf_T *)(-1))
  #define INVALID_WINDOW_VALUE ((win_T *)(-1))
***************
*** 120,126 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("object must be string"));
  	return NULL;
      }
  
--- 122,128 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "object must be string");
  	return NULL;
      }
  
***************
*** 212,219 ****
  {
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError,
! 		_("can't delete OutputObject attributes"));
  	return -1;
      }
  
--- 214,221 ----
  {
      if (val == NULL)
      {
! 	PyErr_SET_STRING(PyExc_AttributeError,
! 		"can't delete OutputObject attributes");
  	return -1;
      }
  
***************
*** 221,227 ****
      {
  	if (!PyInt_Check(val))
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("softspace must be an integer"));
  	    return -1;
  	}
  
--- 223,229 ----
      {
  	if (!PyInt_Check(val))
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "softspace must be an integer");
  	    return -1;
  	}
  
***************
*** 229,235 ****
  	return 0;
      }
  
!     PyErr_SetString(PyExc_AttributeError, _("invalid attribute"));
      return -1;
  }
  
--- 231,237 ----
  	return 0;
      }
  
!     PyErr_SET_STRING(PyExc_AttributeError, "invalid attribute");
      return -1;
  }
  
***************
*** 668,674 ****
  
      if (our_tv == NULL)
      {
! 	PyErr_SetVim(_("invalid expression"));
  	return NULL;
      }
  
--- 670,676 ----
  
      if (our_tv == NULL)
      {
! 	PyErr_SET_VIM("invalid expression");
  	return NULL;
      }
  
***************
*** 719,725 ****
  
      if (our_tv == NULL)
      {
! 	PyErr_SetVim(_("invalid expression"));
  	return NULL;
      }
  
--- 721,727 ----
  
      if (our_tv == NULL)
      {
! 	PyErr_SET_VIM("invalid expression");
  	return NULL;
      }
  
***************
*** 791,797 ****
  	if (VimTryEnd())
  	    return NULL;
  
! 	PyErr_SetVim(_("failed to change directory"));
  	return NULL;
      }
  
--- 793,799 ----
  	if (VimTryEnd())
  	    return NULL;
  
! 	PyErr_SET_VIM("failed to change directory");
  	return NULL;
      }
  
***************
*** 969,976 ****
      if (!PyTuple_Check(find_module_result)
  	    || PyTuple_GET_SIZE(find_module_result) != 3)
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("expected 3-tuple as imp.find_module() result"));
  	return NULL;
      }
  
--- 971,978 ----
      if (!PyTuple_Check(find_module_result)
  	    || PyTuple_GET_SIZE(find_module_result) != 3)
      {
! 	PyErr_SET_STRING(PyExc_TypeError,
! 		"expected 3-tuple as imp.find_module() result");
  	return NULL;
      }
  
***************
*** 978,985 ****
  	    || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
  	    || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
      {
! 	PyErr_SetString(PyExc_RuntimeError,
! 		_("internal error: imp.find_module returned tuple with NULL"));
  	return NULL;
      }
  
--- 980,987 ----
  	    || !(pathname = PyTuple_GET_ITEM(find_module_result, 1))
  	    || !(description = PyTuple_GET_ITEM(find_module_result, 2)))
      {
! 	PyErr_SET_STRING(PyExc_RuntimeError,
! 		"internal error: imp.find_module returned tuple with NULL");
  	return NULL;
      }
  
***************
*** 1350,1357 ****
  {
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError,
! 		_("cannot delete vim.Dictionary attributes"));
  	return -1;
      }
  
--- 1352,1359 ----
  {
      if (val == NULL)
      {
! 	PyErr_SET_STRING(PyExc_AttributeError,
! 		"cannot delete vim.Dictionary attributes");
  	return -1;
      }
  
***************
*** 1359,1365 ****
      {
  	if (self->dict->dv_lock == VAR_FIXED)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("cannot modify fixed dictionary"));
  	    return -1;
  	}
  	else
--- 1361,1367 ----
      {
  	if (self->dict->dv_lock == VAR_FIXED)
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed dictionary");
  	    return -1;
  	}
  	else
***************
*** 1376,1382 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
  	return -1;
      }
  }
--- 1378,1384 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
  	return -1;
      }
  }
***************
*** 1458,1464 ****
      {
  	if (dict->dv_lock)
  	{
! 	    PyErr_SetVim(_("dict is locked"));
  	    Py_DECREF(r);
  	    return NULL;
  	}
--- 1460,1466 ----
      {
  	if (dict->dv_lock)
  	{
! 	    PyErr_SET_VIM("dict is locked");
  	    Py_DECREF(r);
  	    return NULL;
  	}
***************
*** 1509,1516 ****
      if ((*dii)->ht->ht_array != (*dii)->ht_array ||
  	    (*dii)->ht->ht_used != (*dii)->ht_used)
      {
! 	PyErr_SetString(PyExc_RuntimeError,
! 		_("hashtab changed during iteration"));
  	return NULL;
      }
  
--- 1511,1518 ----
      if ((*dii)->ht->ht_array != (*dii)->ht_array ||
  	    (*dii)->ht->ht_used != (*dii)->ht_used)
      {
! 	PyErr_SET_STRING(PyExc_RuntimeError,
! 		"hashtab changed during iteration");
  	return NULL;
      }
  
***************
*** 1561,1567 ****
  
      if (dict->dv_lock)
      {
! 	PyErr_SetVim(_("dict is locked"));
  	return -1;
      }
  
--- 1563,1569 ----
  
      if (dict->dv_lock)
      {
! 	PyErr_SET_VIM("dict is locked");
  	return -1;
      }
  
***************
*** 1616,1622 ****
  	    Py_XDECREF(todecref);
  	    vim_free(di);
  	    dictitem_free(di);
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
  	    return -1;
  	}
      }
--- 1618,1624 ----
  	    Py_XDECREF(todecref);
  	    vim_free(di);
  	    dictitem_free(di);
! 	    PyErr_SET_VIM("failed to add key to dictionary");
  	    return -1;
  	}
      }
***************
*** 1724,1730 ****
  
      if (dict->dv_lock)
      {
! 	PyErr_SetVim(_("dict is locked"));
  	return NULL;
      }
  
--- 1726,1732 ----
  
      if (dict->dv_lock)
      {
! 	PyErr_SET_VIM("dict is locked");
  	return NULL;
      }
  
***************
*** 1780,1787 ****
  		{
  		    Py_DECREF(iterator);
  		    Py_DECREF(fast);
! 		    PyErr_SetString(PyExc_ValueError,
! 			    _("expected sequence element of size 2"));
  		    return NULL;
  		}
  
--- 1782,1789 ----
  		{
  		    Py_DECREF(iterator);
  		    Py_DECREF(fast);
! 		    PyErr_SET_STRING(PyExc_ValueError,
! 			    "expected sequence element of size 2");
  		    return NULL;
  		}
  
***************
*** 1824,1830 ****
  		{
  		    Py_DECREF(iterator);
  		    dictitem_free(di);
! 		    PyErr_SetVim(_("failed to add key to dictionary"));
  		    return NULL;
  		}
  	    }
--- 1826,1832 ----
  		{
  		    Py_DECREF(iterator);
  		    dictitem_free(di);
! 		    PyErr_SET_VIM("failed to add key to dictionary");
  		    return NULL;
  		}
  	    }
***************
*** 2022,2029 ****
  
      if (kwargs)
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("list constructor does not accept keyword arguments"));
  	return NULL;
      }
  
--- 2024,2031 ----
  
      if (kwargs)
      {
! 	PyErr_SET_STRING(PyExc_TypeError,
! 		"list constructor does not accept keyword arguments");
  	return NULL;
      }
  
***************
*** 2078,2090 ****
  
      if (index >= ListLength(self))
      {
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  	return NULL;
      }
      li = list_find(self->list, (long) index);
      if (li == NULL)
      {
! 	PyErr_SetVim(_("internal error: failed to get vim list item"));
  	return NULL;
      }
      return ConvertToPyObject(&li->li_tv);
--- 2080,2092 ----
  
      if (index >= ListLength(self))
      {
! 	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
  	return NULL;
      }
      li = list_find(self->list, (long) index);
      if (li == NULL)
      {
! 	PyErr_SET_VIM("internal error: failed to get vim list item");
  	return NULL;
      }
      return ConvertToPyObject(&li->li_tv);
***************
*** 2197,2208 ****
  
      if (l->lv_lock)
      {
! 	PyErr_SetVim(_("list is locked"));
  	return -1;
      }
      if (index>length || (index==length && obj==NULL))
      {
! 	PyErr_SetString(PyExc_IndexError, _("list index out of range"));
  	return -1;
      }
  
--- 2199,2210 ----
  
      if (l->lv_lock)
      {
! 	PyErr_SET_VIM("list is locked");
  	return -1;
      }
      if (index>length || (index==length && obj==NULL))
      {
! 	PyErr_SET_STRING(PyExc_IndexError, "list index out of range");
  	return -1;
      }
  
***************
*** 2223,2229 ****
  	if (list_append_tv(l, &tv) == FAIL)
  	{
  	    clear_tv(&tv);
! 	    PyErr_SetVim(_("failed to add item to list"));
  	    return -1;
  	}
      }
--- 2225,2231 ----
  	if (list_append_tv(l, &tv) == FAIL)
  	{
  	    clear_tv(&tv);
! 	    PyErr_SET_VIM("failed to add item to list");
  	    return -1;
  	}
      }
***************
*** 2251,2257 ****
  
      if (l->lv_lock)
      {
! 	PyErr_SetVim(_("list is locked"));
  	return -1;
      }
  
--- 2253,2259 ----
  
      if (l->lv_lock)
      {
! 	PyErr_SET_VIM("list is locked");
  	return -1;
      }
  
***************
*** 2264,2270 ****
  	li = list_find(l, (long) first);
  	if (li == NULL)
  	{
! 	    PyErr_SetVim(_("internal error: no vim list item"));
  	    return -1;
  	}
  	if (last > first)
--- 2266,2272 ----
  	li = list_find(l, (long) first);
  	if (li == NULL)
  	{
! 	    PyErr_SET_VIM("internal error: no vim list item");
  	    return -1;
  	}
  	if (last > first)
***************
*** 2297,2303 ****
  	if (list_insert_tv(l, &v, li) == FAIL)
  	{
  	    clear_tv(&v);
! 	    PyErr_SetVim(_("internal error: failed to add item to list"));
  	    return -1;
  	}
  	clear_tv(&v);
--- 2299,2305 ----
  	if (list_insert_tv(l, &v, li) == FAIL)
  	{
  	    clear_tv(&v);
! 	    PyErr_SET_VIM("internal error: failed to add item to list");
  	    return -1;
  	}
  	clear_tv(&v);
***************
*** 2314,2320 ****
  
      if (l->lv_lock)
      {
! 	PyErr_SetVim(_("list is locked"));
  	return NULL;
      }
  
--- 2316,2322 ----
  
      if (l->lv_lock)
      {
! 	PyErr_SET_VIM("list is locked");
  	return NULL;
      }
  
***************
*** 2348,2355 ****
  {
      if (val == NULL)
      {
! 	PyErr_SetString(PyExc_AttributeError,
! 		_("cannot delete vim.List attributes"));
  	return -1;
      }
  
--- 2350,2357 ----
  {
      if (val == NULL)
      {
! 	PyErr_SET_STRING(PyExc_AttributeError,
! 		"cannot delete vim.List attributes");
  	return -1;
      }
  
***************
*** 2357,2363 ****
      {
  	if (self->list->lv_lock == VAR_FIXED)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("cannot modify fixed list"));
  	    return -1;
  	}
  	else
--- 2359,2365 ----
      {
  	if (self->list->lv_lock == VAR_FIXED)
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "cannot modify fixed list");
  	    return -1;
  	}
  	else
***************
*** 2374,2380 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute"));
  	return -1;
      }
  }
--- 2376,2382 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute");
  	return -1;
      }
  }
***************
*** 2409,2416 ****
      {
  	if (!translated_function_exists(name))
  	{
! 	    PyErr_SetString(PyExc_ValueError,
! 		    _("unnamed function does not exist"));
  	    return NULL;
  	}
  	self->name = vim_strsave(name);
--- 2411,2418 ----
      {
  	if (!translated_function_exists(name))
  	{
! 	    PyErr_SET_STRING(PyExc_ValueError,
! 		    "unnamed function does not exist");
  	    return NULL;
  	}
  	self->name = vim_strsave(name);
***************
*** 2421,2427 ****
  				    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
  		== NULL)
  	{
! 	    PyErr_SetString(PyExc_ValueError, _("function does not exist"));
  	    return NULL;
  	}
  
--- 2423,2429 ----
  				    vim_strchr(name, AUTOLOAD_CHAR) == NULL))
  		== NULL)
  	{
! 	    PyErr_SET_STRING(PyExc_ValueError, "function does not exist");
  	    return NULL;
  	}
  
***************
*** 2436,2443 ****
  
      if (kwargs)
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("function constructor does not accept keyword arguments"));
  	return NULL;
      }
  
--- 2438,2445 ----
  
      if (kwargs)
      {
! 	PyErr_SET_STRING(PyExc_TypeError,
! 		"function constructor does not accept keyword arguments");
  	return NULL;
      }
  
***************
*** 2514,2520 ****
      else if (error != OK)
      {
  	result = NULL;
! 	PyErr_SetVim(_("failed to run function"));
      }
      else
  	result = ConvertToPyObject(&rettv);
--- 2516,2522 ----
      else if (error != OK)
      {
  	result = NULL;
! 	PyErr_SET_VIM("failed to run function");
      }
      else
  	result = ConvertToPyObject(&rettv);
***************
*** 2659,2672 ****
  	}
  	else
  	{
! 	    PyErr_SetString(PyExc_RuntimeError,
! 		    _("unable to get option value"));
  	    return NULL;
  	}
      }
      else
      {
! 	PyErr_SetVim("Internal error: unknown option type. Should not happen");
  	return NULL;
      }
  }
--- 2661,2674 ----
  	}
  	else
  	{
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
! 		    "unable to get option value");
  	    return NULL;
  	}
      }
      else
      {
! 	PyErr_SET_VIM("internal error: unknown option type");
  	return NULL;
      }
  }
***************
*** 2709,2715 ****
  	    {
  		if (VimTryEnd())
  		    return -1;
! 		PyErr_SetVim("Problem while switching windows.");
  		return -1;
  	    }
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
--- 2711,2717 ----
  	    {
  		if (VimTryEnd())
  		    return -1;
! 		PyErr_SET_VIM("problem while switching windows");
  		return -1;
  	    }
  	    r = set_option_value_err(key, numval, stringval, opt_flags);
***************
*** 2769,2783 ****
      {
  	if (self->opt_type == SREQ_GLOBAL)
  	{
! 	    PyErr_SetString(PyExc_ValueError,
! 		    _("unable to unset global option"));
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
  	else if (!(flags & SOPT_GLOBAL))
  	{
! 	    PyErr_SetString(PyExc_ValueError, _("unable to unset option "
! 						"without global value"));
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
--- 2771,2784 ----
      {
  	if (self->opt_type == SREQ_GLOBAL)
  	{
! 	    PyErr_SET_STRING(PyExc_ValueError, "unable to unset global option");
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
  	else if (!(flags & SOPT_GLOBAL))
  	{
! 	    PyErr_SET_STRING(PyExc_ValueError, "unable to unset option "
! 					       "without global value");
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
***************
*** 2814,2820 ****
  	    val = PyLong_AsLong(valObject);
  	else
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("object must be integer"));
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
--- 2815,2821 ----
  	    val = PyLong_AsLong(valObject);
  	else
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "object must be integer");
  	    Py_XDECREF(todecref);
  	    return -1;
  	}
***************
*** 2863,2869 ****
  {
      if (self->tab == INVALID_TABPAGE_VALUE)
      {
! 	PyErr_SetVim(_("attempt to refer to deleted tab page"));
  	return -1;
      }
  
--- 2864,2870 ----
  {
      if (self->tab == INVALID_TABPAGE_VALUE)
      {
! 	PyErr_SET_VIM("attempt to refer to deleted tab page");
  	return -1;
      }
  
***************
*** 3007,3013 ****
  	if (n == 0)
  	    return TabPageNew(tp);
  
!     PyErr_SetString(PyExc_IndexError, _("no such tab page"));
      return NULL;
  }
  
--- 3008,3014 ----
  	if (n == 0)
  	    return TabPageNew(tp);
  
!     PyErr_SET_STRING(PyExc_IndexError, "no such tab page");
      return NULL;
  }
  
***************
*** 3028,3034 ****
  {
      if (self->win == INVALID_WINDOW_VALUE)
      {
! 	PyErr_SetVim(_("attempt to refer to deleted window"));
  	return -1;
      }
  
--- 3029,3035 ----
  {
      if (self->win == INVALID_WINDOW_VALUE)
      {
! 	PyErr_SET_VIM("attempt to refer to deleted window");
  	return -1;
      }
  
***************
*** 3194,3200 ****
  
      if (strcmp(name, "buffer") == 0)
      {
! 	PyErr_SetString(PyExc_TypeError, _("readonly attribute"));
  	return -1;
      }
      else if (strcmp(name, "cursor") == 0)
--- 3195,3201 ----
  
      if (strcmp(name, "buffer") == 0)
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "readonly attribute");
  	return -1;
      }
      else if (strcmp(name, "cursor") == 0)
***************
*** 3207,3213 ****
  
  	if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
  	{
! 	    PyErr_SetVim(_("cursor position outside buffer"));
  	    return -1;
  	}
  
--- 3208,3214 ----
  
  	if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count)
  	{
! 	    PyErr_SET_VIM("cursor position outside buffer");
  	    return -1;
  	}
  
***************
*** 3370,3376 ****
  	if (n == 0)
  	    return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
  
!     PyErr_SetString(PyExc_IndexError, _("no such window"));
      return NULL;
  }
  
--- 3371,3377 ----
  	if (n == 0)
  	    return WindowNew(w, self->tabObject? self->tabObject->tab: curtab);
  
!     PyErr_SET_STRING(PyExc_IndexError, "no such window");
      return NULL;
  }
  
***************
*** 3424,3430 ****
  	    --len;
  	else
  	{
! 	    PyErr_SetVim(_("string cannot contain newlines"));
  	    return NULL;
  	}
      }
--- 3425,3431 ----
  	    --len;
  	else
  	{
! 	    PyErr_SET_VIM("string cannot contain newlines");
  	    return NULL;
  	}
      }
***************
*** 3557,3565 ****
  	VimTryStart();
  
  	if (u_savedel((linenr_T)n, 1L) == FAIL)
! 	    PyErr_SetVim(_("cannot save undo information"));
  	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
! 	    PyErr_SetVim(_("cannot delete line"));
  	else
  	{
  	    if (buf == savebuf)
--- 3558,3566 ----
  	VimTryStart();
  
  	if (u_savedel((linenr_T)n, 1L) == FAIL)
! 	    PyErr_SET_VIM("cannot save undo information");
  	else if (ml_delete((linenr_T)n, FALSE) == FAIL)
! 	    PyErr_SET_VIM("cannot delete line");
  	else
  	{
  	    if (buf == savebuf)
***************
*** 3593,3604 ****
  
  	if (u_savesub((linenr_T)n) == FAIL)
  	{
! 	    PyErr_SetVim(_("cannot save undo information"));
  	    vim_free(save);
  	}
  	else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
  	{
! 	    PyErr_SetVim(_("cannot replace line"));
  	    vim_free(save);
  	}
  	else
--- 3594,3605 ----
  
  	if (u_savesub((linenr_T)n) == FAIL)
  	{
! 	    PyErr_SET_VIM("cannot save undo information");
  	    vim_free(save);
  	}
  	else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL)
  	{
! 	    PyErr_SET_VIM("cannot replace line");
  	    vim_free(save);
  	}
  	else
***************
*** 3653,3666 ****
  	switch_buffer(&savebuf, buf);
  
  	if (u_savedel((linenr_T)lo, (long)n) == FAIL)
! 	    PyErr_SetVim(_("cannot save undo information"));
  	else
  	{
  	    for (i = 0; i < n; ++i)
  	    {
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
  		{
! 		    PyErr_SetVim(_("cannot delete line"));
  		    break;
  		}
  	    }
--- 3654,3667 ----
  	switch_buffer(&savebuf, buf);
  
  	if (u_savedel((linenr_T)lo, (long)n) == FAIL)
! 	    PyErr_SET_VIM("cannot save undo information");
  	else
  	{
  	    for (i = 0; i < n; ++i)
  	    {
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
  		{
! 		    PyErr_SET_VIM("cannot delete line");
  		    break;
  		}
  	    }
***************
*** 3721,3727 ****
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
! 	    PyErr_SetVim(_("cannot save undo information"));
  
  	/* If the size of the range is reducing (ie, new_len < old_len) we
  	 * need to delete some old_len. We do this at the start, by
--- 3722,3728 ----
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL)
! 	    PyErr_SET_VIM("cannot save undo information");
  
  	/* If the size of the range is reducing (ie, new_len < old_len) we
  	 * need to delete some old_len. We do this at the start, by
***************
*** 3732,3738 ****
  	    for (i = 0; i < old_len - new_len; ++i)
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
  		{
! 		    PyErr_SetVim(_("cannot delete line"));
  		    break;
  		}
  	    extra -= i;
--- 3733,3739 ----
  	    for (i = 0; i < old_len - new_len; ++i)
  		if (ml_delete((linenr_T)lo, FALSE) == FAIL)
  		{
! 		    PyErr_SET_VIM("cannot delete line");
  		    break;
  		}
  	    extra -= i;
***************
*** 3748,3754 ****
  		if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
  								      == FAIL)
  		{
! 		    PyErr_SetVim(_("cannot replace line"));
  		    break;
  		}
  	}
--- 3749,3755 ----
  		if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE)
  								      == FAIL)
  		{
! 		    PyErr_SET_VIM("cannot replace line");
  		    break;
  		}
  	}
***************
*** 3766,3772 ****
  		if (ml_append((linenr_T)(lo + i - 1),
  					(char_u *)array[i], 0, FALSE) == FAIL)
  		{
! 		    PyErr_SetVim(_("cannot insert line"));
  		    break;
  		}
  		vim_free(array[i]);
--- 3767,3773 ----
  		if (ml_append((linenr_T)(lo + i - 1),
  					(char_u *)array[i], 0, FALSE) == FAIL)
  		{
! 		    PyErr_SET_VIM("cannot insert line");
  		    break;
  		}
  		vim_free(array[i]);
***************
*** 3843,3851 ****
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
! 	    PyErr_SetVim(_("cannot save undo information"));
  	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
! 	    PyErr_SetVim(_("cannot insert line"));
  	else
  	    appended_lines_mark((linenr_T)n, 1L);
  
--- 3844,3852 ----
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL)
! 	    PyErr_SET_VIM("cannot save undo information");
  	else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL)
! 	    PyErr_SET_VIM("cannot insert line");
  	else
  	    appended_lines_mark((linenr_T)n, 1L);
  
***************
*** 3894,3900 ****
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
! 	    PyErr_SetVim(_("cannot save undo information"));
  	else
  	{
  	    for (i = 0; i < size; ++i)
--- 3895,3901 ----
  	switch_buffer(&savebuf, buf);
  
  	if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL)
! 	    PyErr_SET_VIM("cannot save undo information");
  	else
  	{
  	    for (i = 0; i < size; ++i)
***************
*** 3902,3908 ****
  		if (ml_append((linenr_T)(n + i),
  					(char_u *)array[i], 0, FALSE) == FAIL)
  		{
! 		    PyErr_SetVim(_("cannot insert line"));
  
  		    /* Free the rest of the lines */
  		    while (i < size)
--- 3903,3909 ----
  		if (ml_append((linenr_T)(n + i),
  					(char_u *)array[i], 0, FALSE) == FAIL)
  		{
! 		    PyErr_SET_VIM("cannot insert line");
  
  		    /* Free the rest of the lines */
  		    while (i < size)
***************
*** 3955,3961 ****
  {
      if (self->buf == INVALID_BUFFER_VALUE)
      {
! 	PyErr_SetVim(_("attempt to refer to deleted buffer"));
  	return -1;
      }
  
--- 3956,3962 ----
  {
      if (self->buf == INVALID_BUFFER_VALUE)
      {
! 	PyErr_SET_VIM("attempt to refer to deleted buffer");
  	return -1;
      }
  
***************
*** 3976,3982 ****
  
      if (n < 0 || n > end - start)
      {
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
  	return NULL;
      }
  
--- 3977,3983 ----
  
      if (n < 0 || n > end - start)
      {
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
  	return NULL;
      }
  
***************
*** 4026,4032 ****
  
      if (n < 0 || n > end - start)
      {
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
  	return -1;
      }
  
--- 4027,4033 ----
  
      if (n < 0 || n > end - start)
      {
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
  	return -1;
      }
  
***************
*** 4098,4104 ****
  
      if (n < 0 || n > max)
      {
! 	PyErr_SetString(PyExc_IndexError, _("line number out of range"));
  	return NULL;
      }
  
--- 4099,4105 ----
  
      if (n < 0 || n > max)
      {
! 	PyErr_SET_STRING(PyExc_IndexError, "line number out of range");
  	return NULL;
      }
  
***************
*** 4381,4387 ****
  
  	if (r == FAIL)
  	{
! 	    PyErr_SetVim(_("failed to rename buffer"));
  	    return -1;
  	}
  	return 0;
--- 4382,4388 ----
  
  	if (r == FAIL)
  	{
! 	    PyErr_SET_VIM("failed to rename buffer");
  	    return -1;
  	}
  	return 0;
***************
*** 4416,4423 ****
  
      if (pmark[0] == '\0' || pmark[1] != '\0')
      {
! 	PyErr_SetString(PyExc_ValueError,
! 		_("mark name must be a single character"));
  	return NULL;
      }
  
--- 4417,4424 ----
  
      if (pmark[0] == '\0' || pmark[1] != '\0')
      {
! 	PyErr_SET_STRING(PyExc_ValueError,
! 		"mark name must be a single character");
  	return NULL;
      }
  
***************
*** 4434,4440 ****
  
      if (posp == NULL)
      {
! 	PyErr_SetVim(_("invalid mark name"));
  	return NULL;
      }
  
--- 4435,4441 ----
  
      if (posp == NULL)
      {
! 	PyErr_SET_VIM("invalid mark name");
  	return NULL;
      }
  
***************
*** 4529,4535 ****
  	bnr = PyLong_AsLong(keyObject);
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("key must be integer"));
  	return NULL;
      }
  
--- 4530,4536 ----
  	bnr = PyLong_AsLong(keyObject);
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "key must be integer");
  	return NULL;
      }
  
***************
*** 4667,4673 ****
  
  	if (value->ob_type != &BufferType)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.Buffer object"));
  	    return -1;
  	}
  
--- 4668,4674 ----
  
  	if (value->ob_type != &BufferType)
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.Buffer object");
  	    return -1;
  	}
  
***************
*** 4680,4686 ****
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SetVim(_("failed to switch to given buffer"));
  	    return -1;
  	}
  
--- 4681,4687 ----
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SET_VIM("failed to switch to given buffer");
  	    return -1;
  	}
  
***************
*** 4692,4698 ****
  
  	if (value->ob_type != &WindowType)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.Window object"));
  	    return -1;
  	}
  
--- 4693,4699 ----
  
  	if (value->ob_type != &WindowType)
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.Window object");
  	    return -1;
  	}
  
***************
*** 4702,4709 ****
  
  	if (!count)
  	{
! 	    PyErr_SetString(PyExc_ValueError,
! 		    _("failed to find window in the current tab page"));
  	    return -1;
  	}
  
--- 4703,4710 ----
  
  	if (!count)
  	{
! 	    PyErr_SET_STRING(PyExc_ValueError,
! 		    "failed to find window in the current tab page");
  	    return -1;
  	}
  
***************
*** 4713,4720 ****
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SetString(PyExc_RuntimeError,
! 		    _("did not switch to the specified window"));
  	    return -1;
  	}
  
--- 4714,4721 ----
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
! 		    "did not switch to the specified window");
  	    return -1;
  	}
  
***************
*** 4724,4730 ****
      {
  	if (value->ob_type != &TabPageType)
  	{
! 	    PyErr_SetString(PyExc_TypeError, _("expected vim.TabPage object"));
  	    return -1;
  	}
  
--- 4725,4731 ----
      {
  	if (value->ob_type != &TabPageType)
  	{
! 	    PyErr_SET_STRING(PyExc_TypeError, "expected vim.TabPage object");
  	    return -1;
  	}
  
***************
*** 4737,4744 ****
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SetString(PyExc_RuntimeError,
! 		    _("did not switch to the specified tab page"));
  	    return -1;
  	}
  
--- 4738,4745 ----
  	{
  	    if (VimTryEnd())
  		return -1;
! 	    PyErr_SET_STRING(PyExc_RuntimeError,
! 		    "did not switch to the specified tab page");
  	    return -1;
  	}
  
***************
*** 5005,5011 ****
  	    clear_tv(&di->di_tv);
  	    vim_free(di);
  	    dict_unref(dict);
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
  	    return -1;
  	}
      }
--- 5006,5012 ----
  	    clear_tv(&di->di_tv);
  	    vim_free(di);
  	    dict_unref(dict);
! 	    PyErr_SET_VIM("failed to add key to dictionary");
  	    return -1;
  	}
      }
***************
*** 5107,5113 ****
  	    Py_DECREF(iterator);
  	    dictitem_free(di);
  	    dict_unref(dict);
! 	    PyErr_SetVim(_("failed to add key to dictionary"));
  	    return -1;
  	}
      }
--- 5108,5114 ----
  	    Py_DECREF(iterator);
  	    dictitem_free(di);
  	    dict_unref(dict);
! 	    PyErr_SET_VIM("failed to add key to dictionary");
  	    return -1;
  	}
      }
***************
*** 5215,5222 ****
  	r = convert_dl(obj, tv, pymap_to_tv, lookup_dict);
      else
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("unable to convert object to vim dictionary"));
  	r = -1;
      }
      Py_DECREF(lookup_dict);
--- 5216,5223 ----
  	r = convert_dl(obj, tv, pymap_to_tv, lookup_dict);
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError,
! 		"unable to convert object to vim dictionary");
  	r = -1;
      }
      Py_DECREF(lookup_dict);
***************
*** 5325,5332 ****
  	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
      else
      {
! 	PyErr_SetString(PyExc_TypeError,
! 		_("unable to convert to vim structure"));
  	return -1;
      }
      return 0;
--- 5326,5333 ----
  	return convert_dl(obj, tv, pymap_to_tv, lookup_dict);
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError,
! 		"unable to convert to vim structure");
  	return -1;
      }
      return 0;
***************
*** 5337,5343 ****
  {
      if (tv == NULL)
      {
! 	PyErr_SetVim(_("NULL reference passed"));
  	return NULL;
      }
      switch (tv->v_type)
--- 5338,5344 ----
  {
      if (tv == NULL)
      {
! 	PyErr_SET_VIM("NULL reference passed");
  	return NULL;
      }
      switch (tv->v_type)
***************
*** 5362,5368 ****
  	    Py_INCREF(Py_None);
  	    return Py_None;
  	default:
! 	    PyErr_SetVim(_("internal error: invalid value type"));
  	    return NULL;
      }
  }
--- 5363,5369 ----
  	    Py_INCREF(Py_None);
  	    return Py_None;
  	default:
! 	    PyErr_SET_VIM("internal error: invalid value type");
  	    return NULL;
      }
  }
diff -crN vim.b9d4dfa09951/src/if_python3.c vim.abcf5d9458ee/src/if_python3.c
*** vim.b9d4dfa09951/src/if_python3.c	2013-06-16 19:25:54.796645369 +0400
--- vim.abcf5d9458ee/src/if_python3.c	2013-06-16 19:25:54.808645254 +0400
***************
*** 1169,1175 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
--- 1169,1175 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return NULL;
      }
  }
***************
*** 1203,1209 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
--- 1203,1209 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return -1;
      }
  }
***************
*** 1285,1291 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
--- 1285,1291 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return NULL;
      }
  }
***************
*** 1312,1318 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
--- 1312,1318 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return -1;
      }
  }
***************
*** 1491,1497 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return NULL;
      }
  }
--- 1491,1497 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return NULL;
      }
  }
***************
*** 1515,1521 ****
      }
      else
      {
! 	PyErr_SetString(PyExc_TypeError, _("index must be int or slice"));
  	return -1;
      }
  }
--- 1515,1521 ----
      }
      else
      {
! 	PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice");
  	return -1;
      }
  }

Raspunde prin e-mail lui