From 8fd588fb4d0378396bbffa9233eabcca4ded65bc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 21 Jun 2013 18:31:23 +0200 Subject: [PATCH 01/20] updated for version 7.3.1224 Problem: Clang gives warnings on xxd. Solution: Change how to use part of a string. (Dominique Pelle) Also avoid warning for return not reached. --- src/regexp_nfa.c | 4 ++-- src/version.c | 2 ++ src/xxd/xxd.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index f11c01a9c7..01bc065b96 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -2611,7 +2611,7 @@ nfa_max_width(startstate, depth) if (depth > 4) return -1; - for (;;) + while (state != NULL) { switch (state->c) { @@ -2810,7 +2810,7 @@ nfa_max_width(startstate, depth) state = state->out; } - /* unrecognized */ + /* unrecognized, "cannot happen" */ return -1; } diff --git a/src/version.c b/src/version.c index 9a484dd086..1bc2bae5db 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1224, /**/ 1223, /**/ diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c index 209ede43d1..e19874ad79 100644 --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -722,7 +722,7 @@ main(argc, argv) while ((length < 0 || p < length) && (c = getc(fp)) != EOF) { if (fprintf(fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X", - (p % cols) ? ", " : ",\n "+2*!p, c) < 0) + (p % cols) ? ", " : &",\n "[2*!p], c) < 0) die(3); p++; } @@ -731,7 +731,7 @@ main(argc, argv) if (p && fputs("\n", fpo) == EOF) die(3); - if (fputs("};\n" + 3 * (fp == stdin), fpo) == EOF) + if (fputs(&"};\n"[3 * (fp == stdin)], fpo) == EOF) die(3); if (fp != stdin) From 80432ced82c62281fbdfeff7cbda1dcea7aa3494 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 21 Jun 2013 18:31:23 +0200 Subject: [PATCH 02/20] Added tag v7-3-1224 for changeset 0a379dea13c9 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3041e70b62..e3f1e61c32 100644 --- a/.hgtags +++ b/.hgtags @@ -2560,3 +2560,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 9f7b92f232d31450fd04ecec3e89b027c0f28b02 v7-3-1221 07831d280e90a87ab9f42a9c96775ef2bc0cdedf v7-3-1222 5cd32322154c1c5970194eb5300eec2ddb8ccc30 v7-3-1223 +0a379dea13c97df4ec2ba1487dd50c1e8ba0c912 v7-3-1224 From e5857c8449699962772c6567b5df711265f473b1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 22 Jun 2013 13:00:16 +0200 Subject: [PATCH 03/20] updated for version 7.3.1225 Problem: Compiler warnings when building with Motif. Solution: Change set_label() argument. (Kazunobu Kuriyama) --- src/gui_motif.c | 4 ++-- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui_motif.c b/src/gui_motif.c index 5b6c7a7643..57f264df95 100644 --- a/src/gui_motif.c +++ b/src/gui_motif.c @@ -3653,7 +3653,7 @@ find_replace_keypress(w, frdp, event) static void set_label(w, label) Widget w; - char_u *label; + char *label; { XmString str; char_u *p, *next; @@ -3662,7 +3662,7 @@ set_label(w, label) if (!w) return; - p = vim_strsave(label); + p = vim_strsave((char_u *)label); if (p == NULL) return; for (next = p; *next; ++next) diff --git a/src/version.c b/src/version.c index 1bc2bae5db..4d2e7a9625 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1225, /**/ 1224, /**/ From bd9087fd48a13c32af9dee89d6038cc66d93401a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 22 Jun 2013 13:00:16 +0200 Subject: [PATCH 04/20] Added tag v7-3-1225 for changeset 27b008d5b7ac --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e3f1e61c32..f4524148b3 100644 --- a/.hgtags +++ b/.hgtags @@ -2561,3 +2561,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 07831d280e90a87ab9f42a9c96775ef2bc0cdedf v7-3-1222 5cd32322154c1c5970194eb5300eec2ddb8ccc30 v7-3-1223 0a379dea13c97df4ec2ba1487dd50c1e8ba0c912 v7-3-1224 +27b008d5b7ac5fab02c6934b87f258bc4715aed6 v7-3-1225 From 83d8aa75d3311d569a2244b0dd62a5f35e86ad2b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 12:51:32 +0200 Subject: [PATCH 05/20] updated for version 7.3.1226 Problem: Python: duplicate code. Solution: Share code between OutputWrite() and OutputWritelines(). (ZyX) --- src/if_py_both.h | 50 +++++++++++++++++++------------------------ src/testdir/test86.ok | 2 +- src/testdir/test87.ok | 2 +- src/version.c | 2 ++ 4 files changed, 26 insertions(+), 30 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 9acb3105b2..164e2a42aa 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -281,15 +281,15 @@ writer(writefn fn, char_u *str, PyInt n) } } - static PyObject * -OutputWrite(OutputObject *self, PyObject *args) + static int +write_output(OutputObject *self, PyObject *string) { - Py_ssize_t len = 0; - char *str = NULL; - int error = self->error; + Py_ssize_t len = 0; + char *str = NULL; + int error = self->error; - if (!PyArg_ParseTuple(args, "et#", ENC_OPT, &str, &len)) - return NULL; + if (!PyArg_Parse(string, "et#", ENC_OPT, &str, &len)) + return -1; Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); @@ -298,44 +298,37 @@ OutputWrite(OutputObject *self, PyObject *args) Py_END_ALLOW_THREADS PyMem_Free(str); + return 0; +} + + static PyObject * +OutputWrite(OutputObject *self, PyObject *string) +{ + if (write_output(self, string)) + return NULL; + Py_INCREF(Py_None); return Py_None; } static PyObject * -OutputWritelines(OutputObject *self, PyObject *args) +OutputWritelines(OutputObject *self, PyObject *seq) { - PyObject *seq; PyObject *iterator; PyObject *item; - int error = self->error; - - if (!PyArg_ParseTuple(args, "O", &seq)) - return NULL; if (!(iterator = PyObject_GetIter(seq))) return NULL; while ((item = PyIter_Next(iterator))) { - char *str = NULL; - PyInt len; - - if (!PyArg_Parse(item, "et#", ENC_OPT, &str, &len)) + if (write_output(self, item)) { - PyErr_SetString(PyExc_TypeError, _("writelines() requires list of strings")); Py_DECREF(iterator); Py_DECREF(item); return NULL; } Py_DECREF(item); - - Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); - writer((writefn)(error ? emsg : msg), (char_u *)str, len); - Python_Release_Vim(); - Py_END_ALLOW_THREADS - PyMem_Free(str); } Py_DECREF(iterator); @@ -360,8 +353,8 @@ OutputFlush(PyObject *self UNUSED) static struct PyMethodDef OutputMethods[] = { /* name, function, calling, doc */ - {"write", (PyCFunction)OutputWrite, METH_VARARGS, ""}, - {"writelines", (PyCFunction)OutputWritelines, METH_VARARGS, ""}, + {"write", (PyCFunction)OutputWrite, METH_O, ""}, + {"writelines", (PyCFunction)OutputWritelines, METH_O, ""}, {"flush", (PyCFunction)OutputFlush, METH_NOARGS, ""}, {"__dir__", (PyCFunction)OutputDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} @@ -3009,7 +3002,8 @@ TabListItem(PyObject *self UNUSED, PyInt n) return NULL; } -/* Window object +/* + * Window object */ typedef struct diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index a4f1ac4051..05d194338b 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -444,7 +444,7 @@ sys.stdout.attr = None:AttributeError:('invalid attribute',) sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) >> OutputWriteLines sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) -sys.stdout.writelines([1]):TypeError:('writelines() requires list of strings',) +sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',) > VimCommand vim.command(1):TypeError:('must be string, not int',) > VimToPython diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 1d4044519d..414dc9e424 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -433,7 +433,7 @@ sys.stdout.attr = None:(, AttributeError('invalid attrib sys.stdout.write(None):(, TypeError("Can't convert 'NoneType' object to str implicitly",)) >> OutputWriteLines sys.stdout.writelines(None):(, TypeError("'NoneType' object is not iterable",)) -sys.stdout.writelines([1]):(, TypeError('writelines() requires list of strings',)) +sys.stdout.writelines([1]):(, TypeError("Can't convert 'int' object to str implicitly",)) >>> Testing *Iter* using sys.stdout.writelines(%s) sys.stdout.writelines(FailingIter()):(, NotImplementedError()) sys.stdout.writelines(FailingIterNext()):(, NotImplementedError()) diff --git a/src/version.c b/src/version.c index 4d2e7a9625..8e33ab6213 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1226, /**/ 1225, /**/ From 6e60fc467083ca5bf44564f662ef2d97c070a28f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 12:51:32 +0200 Subject: [PATCH 06/20] Added tag v7-3-1226 for changeset b34d719b13cd --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f4524148b3..f48cda31bf 100644 --- a/.hgtags +++ b/.hgtags @@ -2562,3 +2562,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 5cd32322154c1c5970194eb5300eec2ddb8ccc30 v7-3-1223 0a379dea13c97df4ec2ba1487dd50c1e8ba0c912 v7-3-1224 27b008d5b7ac5fab02c6934b87f258bc4715aed6 v7-3-1225 +b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 From d9a5c6902feea87c4cfc7300c29fdd03141b8f08 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:00:44 +0200 Subject: [PATCH 07/20] updated for version 7.3.1227 Problem: Inconsistent string conversion. Solution: Use 'encoding' instead of utf-8. Use METH_O in place of METH_VARARGS where appropriate. (ZyX) --- src/if_py_both.h | 104 +++++++++++++++++++++++------------------- src/testdir/test86.ok | 12 ++--- src/testdir/test87.ok | 12 ++--- src/version.c | 2 + 4 files changed, 72 insertions(+), 58 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 164e2a42aa..64b7e542f2 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -466,21 +466,20 @@ VimCheckInterrupt(void) */ static PyObject * -VimCommand(PyObject *self UNUSED, PyObject *args) +VimCommand(PyObject *self UNUSED, PyObject *string) { - char *cmd; - PyObject *result; + char_u *cmd; + PyObject *result; + PyObject *todecref; - if (!PyArg_ParseTuple(args, "s", &cmd)) + if (!(cmd = StringToChars(string, &todecref))) return NULL; - PyErr_Clear(); - Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); VimTryStart(); - do_cmdline_cmd((char_u *)cmd); + do_cmdline_cmd(cmd); update_screen(VALID); Python_Release_Vim(); @@ -491,8 +490,8 @@ VimCommand(PyObject *self UNUSED, PyObject *args) else result = Py_None; - Py_XINCREF(result); + Py_XDECREF(todecref); return result; } @@ -641,21 +640,28 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) static PyObject * VimEval(PyObject *self UNUSED, PyObject *args) { - char *expr; + char_u *expr; typval_T *our_tv; + PyObject *string; + PyObject *todecref; PyObject *result; - PyObject *lookup_dict; + PyObject *lookup_dict; - if (!PyArg_ParseTuple(args, "s", &expr)) + if (!PyArg_ParseTuple(args, "O", &string)) + return NULL; + + if (!(expr = StringToChars(string, &todecref))) return NULL; Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); VimTryStart(); - our_tv = eval_expr((char_u *)expr, NULL); + our_tv = eval_expr(expr, NULL); Python_Release_Vim(); Py_END_ALLOW_THREADS + Py_XDECREF(todecref); + if (VimTryEnd()) return NULL; @@ -688,22 +694,25 @@ VimEval(PyObject *self UNUSED, PyObject *args) static PyObject *ConvertToPyObject(typval_T *); static PyObject * -VimEvalPy(PyObject *self UNUSED, PyObject *args) +VimEvalPy(PyObject *self UNUSED, PyObject *string) { - char *expr; typval_T *our_tv; PyObject *result; + char_u *expr; + PyObject *todecref; - if (!PyArg_ParseTuple(args, "s", &expr)) + if (!(expr = StringToChars(string, &todecref))) return NULL; Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); VimTryStart(); - our_tv = eval_expr((char_u *)expr, NULL); + our_tv = eval_expr(expr, NULL); Python_Release_Vim(); Py_END_ALLOW_THREADS + Py_XDECREF(todecref); + if (VimTryEnd()) return NULL; @@ -724,20 +733,24 @@ VimEvalPy(PyObject *self UNUSED, PyObject *args) } static PyObject * -VimStrwidth(PyObject *self UNUSED, PyObject *args) +VimStrwidth(PyObject *self UNUSED, PyObject *string) { - char *expr; + char_u *str; + PyObject *todecref; + int result; - if (!PyArg_ParseTuple(args, "s", &expr)) + if (!(str = StringToChars(string, &todecref))) return NULL; - return PyLong_FromLong( #ifdef FEAT_MBYTE - mb_string2cells((char_u *)expr, (int)STRLEN(expr)) + result = mb_string2cells(str, (int)STRLEN(str)); #else - STRLEN(expr) + result = STRLEN(str); #endif - ); + + Py_XDECREF(todecref); + + return PyLong_FromLong(result); } static PyObject * @@ -840,13 +853,11 @@ map_rtp_callback(char_u *path, void *_data) } static PyObject * -VimForeachRTP(PyObject *self UNUSED, PyObject *args) +VimForeachRTP(PyObject *self UNUSED, PyObject *callable) { map_rtp_data data; - if (!PyArg_ParseTuple(args, "O", &data.callable)) - return NULL; - + data.callable = callable; data.result = NULL; do_in_runtimepath(NULL, FALSE, &map_rtp_callback, &data); @@ -1099,13 +1110,13 @@ VimPathHook(PyObject *self UNUSED, PyObject *args) static struct PyMethodDef VimMethods[] = { /* name, function, calling, documentation */ - {"command", VimCommand, METH_VARARGS, "Execute a Vim ex-mode command" }, + {"command", VimCommand, METH_O, "Execute a Vim ex-mode command" }, {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" }, - {"bindeval", VimEvalPy, METH_VARARGS, "Like eval(), but returns objects attached to vim ones"}, - {"strwidth", VimStrwidth, METH_VARARGS, "Screen string width, counts as having width 1"}, + {"bindeval", VimEvalPy, METH_O, "Like eval(), but returns objects attached to vim ones"}, + {"strwidth", VimStrwidth, METH_O, "Screen string width, counts as having width 1"}, {"chdir", (PyCFunction)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, {"fchdir", (PyCFunction)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, - {"foreach_rtp", VimForeachRTP, METH_VARARGS, "Call given callable for each path in &rtp"}, + {"foreach_rtp", VimForeachRTP, METH_O, "Call given callable for each path in &rtp"}, {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"}, {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"}, {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"}, @@ -1733,7 +1744,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) { PyObject *object; - if (!PyArg_Parse(args, "(O)", &object)) + if (!PyArg_ParseTuple(args, "O", &object)) return NULL; if (PyObject_HasAttrString(object, "keys")) @@ -1877,13 +1888,8 @@ DictionaryPopItem(DictionaryObject *self) } static PyObject * -DictionaryHasKey(DictionaryObject *self, PyObject *args) +DictionaryHasKey(DictionaryObject *self, PyObject *keyObject) { - PyObject *keyObject; - - if (!PyArg_ParseTuple(args, "O", &keyObject)) - return NULL; - return _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL); } @@ -1914,7 +1920,7 @@ static struct PyMethodDef DictionaryMethods[] = { {"get", (PyCFunction)DictionaryGet, METH_VARARGS, ""}, {"pop", (PyCFunction)DictionaryPop, METH_VARARGS, ""}, {"popitem", (PyCFunction)DictionaryPopItem, METH_NOARGS, ""}, - {"has_key", (PyCFunction)DictionaryHasKey, METH_VARARGS, ""}, + {"has_key", (PyCFunction)DictionaryHasKey, METH_O, ""}, {"__dir__", (PyCFunction)DictionaryDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} }; @@ -2434,11 +2440,13 @@ FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) return NULL; } - if (!PyArg_ParseTuple(args, "s", &name)) + if (!PyArg_ParseTuple(args, "et", "ascii", &name)) return NULL; self = FunctionNew(subtype, name); + PyMem_Free(name); + return self; } @@ -4383,20 +4391,21 @@ BufferAppend(BufferObject *self, PyObject *args) } static PyObject * -BufferMark(BufferObject *self, PyObject *args) +BufferMark(BufferObject *self, PyObject *pmarkObject) { pos_T *posp; - char *pmark; - char mark; + char_u *pmark; + char_u mark; buf_T *savebuf; + PyObject *todecref; if (CheckBuffer(self)) return NULL; - if (!PyArg_ParseTuple(args, "s", &pmark)) + if (!(pmark = StringToChars(pmarkObject, &todecref))) return NULL; - if (STRLEN(pmark) != 1) + if (pmark[0] == '\0' || pmark[1] != '\0') { PyErr_SetString(PyExc_ValueError, _("mark name must be a single character")); @@ -4404,6 +4413,9 @@ BufferMark(BufferObject *self, PyObject *args) } mark = *pmark; + + Py_XDECREF(todecref); + VimTryStart(); switch_buffer(&savebuf, self->buf); posp = getmark(mark, FALSE); @@ -4461,7 +4473,7 @@ BufferRepr(BufferObject *self) static struct PyMethodDef BufferMethods[] = { /* name, function, calling, documentation */ {"append", (PyCFunction)BufferAppend, METH_VARARGS, "Append data to Vim buffer" }, - {"mark", (PyCFunction)BufferMark, METH_VARARGS, "Return (row,col) representing position of named mark" }, + {"mark", (PyCFunction)BufferMark, METH_O, "Return (row,col) representing position of named mark" }, {"range", (PyCFunction)BufferRange, METH_VARARGS, "Return a range object which represents the part of the given buffer between line numbers s and e" }, {"__dir__", (PyCFunction)BufferDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 05d194338b..27a1372333 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -446,14 +446,14 @@ sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, N sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',) > VimCommand -vim.command(1):TypeError:('must be string, not int',) +vim.command(1):TypeError:('object must be string',) > VimToPython > VimEval -vim.eval(1):TypeError:('must be string, not int',) +vim.eval(1):TypeError:('object must be string',) > VimEvalPy -vim.bindeval(1):TypeError:('must be string, not int',) +vim.bindeval(1):TypeError:('object must be string',) > VimStrwidth -vim.strwidth(1):TypeError:('must be string, not int',) +vim.strwidth(1):TypeError:('object must be string',) > Dictionary >> DictionaryConstructor vim.Dictionary("abc"):ValueError:('expected sequence element of size 2',) @@ -683,7 +683,7 @@ d.update((("a", FailingMappingKey()),)):NotImplementedError:() >> DictionaryPopItem d.popitem(1, 2):TypeError:('popitem() takes no arguments (2 given)',) >> DictionaryHasKey -d.has_key():TypeError:('function takes exactly 1 argument (0 given)',) +d.has_key():TypeError:('has_key() takes exactly one argument (0 given)',) > List >> ListConstructor vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',) @@ -1065,7 +1065,7 @@ vim.current.buffer.xxx:AttributeError:('xxx',) vim.current.buffer.name = True:TypeError:('object must be string',) vim.current.buffer.xxx = True:AttributeError:('xxx',) >> BufferMark -vim.current.buffer.mark(0):TypeError:('must be string, not int',) +vim.current.buffer.mark(0):TypeError:('object must be string',) vim.current.buffer.mark("abc"):ValueError:('mark name must be a single character',) vim.current.buffer.mark("!"):error:('invalid mark name',) >> BufferRange diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 414dc9e424..7ee1a1ca2b 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -439,14 +439,14 @@ sys.stdout.writelines(FailingIter()):(, NotImplemen sys.stdout.writelines(FailingIterNext()):(, NotImplementedError()) <<< Finished > VimCommand -vim.command(1):(, TypeError('must be str, not int',)) +vim.command(1):(, TypeError('object must be string',)) > VimToPython > VimEval -vim.eval(1):(, TypeError('must be str, not int',)) +vim.eval(1):(, TypeError('object must be string',)) > VimEvalPy -vim.bindeval(1):(, TypeError('must be str, not int',)) +vim.bindeval(1):(, TypeError('object must be string',)) > VimStrwidth -vim.strwidth(1):(, TypeError('must be str, not int',)) +vim.strwidth(1):(, TypeError('object must be string',)) > Dictionary >> DictionaryConstructor vim.Dictionary("abc"):(, ValueError('expected sequence element of size 2',)) @@ -680,7 +680,7 @@ d.update((("a", FailingMappingKey()),)):(, NotImple >> DictionaryPopItem d.popitem(1, 2):(, TypeError('popitem() takes no arguments (2 given)',)) >> DictionaryHasKey -d.has_key():(, TypeError('function takes exactly 1 argument (0 given)',)) +d.has_key():(, TypeError('has_key() takes exactly one argument (0 given)',)) > List >> ListConstructor vim.List(1, 2):(, TypeError('function takes at most 1 argument (2 given)',)) @@ -1074,7 +1074,7 @@ vim.current.buffer.xxx:(, AttributeError("'vim.buffer' o vim.current.buffer.name = True:(, TypeError('object must be string',)) vim.current.buffer.xxx = True:(, AttributeError('xxx',)) >> BufferMark -vim.current.buffer.mark(0):(, TypeError('must be str, not int',)) +vim.current.buffer.mark(0):(, TypeError('object must be string',)) vim.current.buffer.mark("abc"):(, ValueError('mark name must be a single character',)) vim.current.buffer.mark("!"):(, error('invalid mark name',)) >> BufferRange diff --git a/src/version.c b/src/version.c index 8e33ab6213..29a1b28161 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1227, /**/ 1226, /**/ From 33896b6370a4fc63b6932fa8da3e6623cd58df59 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:00:44 +0200 Subject: [PATCH 08/20] Added tag v7-3-1227 for changeset 5cee875f3096 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f48cda31bf..0748b274a4 100644 --- a/.hgtags +++ b/.hgtags @@ -2563,3 +2563,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 0a379dea13c97df4ec2ba1487dd50c1e8ba0c912 v7-3-1224 27b008d5b7ac5fab02c6934b87f258bc4715aed6 v7-3-1225 b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 +5cee875f30961cf1adadf386b7e2764ea8aeeb64 v7-3-1227 From 20ee11385a2c1b9b1612b93de32c20a807912e2b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:11:18 +0200 Subject: [PATCH 09/20] updated for version 7.3.1228 Problem: Python: various inconsistencies and problems. Solution: StringToLine now supports both bytes() and unicode() objects. Make function names consistant. Fix memory leak fixed in StringToLine. (ZyX) --- src/if_py_both.h | 73 +++++++++++++++++++++++++++--------------------- src/if_python.c | 9 ++---- src/if_python3.c | 7 +---- src/version.c | 2 ++ 4 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 64b7e542f2..71c30af41f 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -18,7 +18,7 @@ typedef int Py_ssize_t; /* Python 2.4 and earlier don't have this type. */ #endif #ifdef FEAT_MBYTE -# define ENC_OPT p_enc +# define ENC_OPT ((char *)p_enc) #else # define ENC_OPT "latin1" #endif @@ -92,28 +92,29 @@ Python_Release_Vim(void) StringToChars(PyObject *object, PyObject **todecref) { char_u *p; - PyObject *bytes = NULL; if (PyBytes_Check(object)) { - if (PyString_AsStringAndSize(object, (char **) &p, NULL) == -1) - return NULL; - if (p == NULL) + if (PyBytes_AsStringAndSize(object, (char **) &p, NULL) == -1 + || p == NULL) return NULL; *todecref = NULL; } else if (PyUnicode_Check(object)) { - bytes = PyUnicode_AsEncodedString(object, (char *)ENC_OPT, NULL); - if (bytes == NULL) + PyObject *bytes; + + if (!(bytes = PyUnicode_AsEncodedString(object, ENC_OPT, NULL))) return NULL; - if(PyString_AsStringAndSize(bytes, (char **) &p, NULL) == -1) - return NULL; - if (p == NULL) + if(PyBytes_AsStringAndSize(bytes, (char **) &p, NULL) == -1 + || p == NULL) + { + Py_DECREF(bytes); return NULL; + } *todecref = bytes; } @@ -133,6 +134,7 @@ add_string(PyObject *list, char *s) if (!(string = PyString_FromString(s))) return -1; + if (PyList_Append(list, string)) { Py_DECREF(string); @@ -534,10 +536,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) } if (our_tv->v_type == VAR_STRING) - { result = PyString_FromString(our_tv->vval.v_string == NULL ? "" : (char *)our_tv->vval.v_string); - } else if (our_tv->v_type == VAR_NUMBER) { char buf[NUMBUFLEN]; @@ -3385,22 +3385,31 @@ WinListItem(WinListObject *self, PyInt n) static char * StringToLine(PyObject *obj) { - const char *str; - char *save; - PyObject *bytes; - PyInt len; - PyInt i; - char *p; + char *str; + char *save; + PyObject *bytes = NULL; + Py_ssize_t len; + PyInt i; + char *p; - if (obj == NULL || !PyString_Check(obj)) + if (PyBytes_Check(obj)) { - PyErr_BadArgument(); - return NULL; + if (PyBytes_AsStringAndSize(obj, &str, &len) == -1 + || str == NULL) + return NULL; } + else if (PyUnicode_Check(obj)) + { + if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL))) + return NULL; - bytes = PyString_AsBytes(obj); /* for Python 2 this does nothing */ - str = PyString_AsString(bytes); - len = PyString_Size(bytes); + if(PyBytes_AsStringAndSize(bytes, &str, &len) == -1 + || str == NULL) + { + Py_DECREF(bytes); + return NULL; + } + } /* * Error checking: String must not contain newlines, as we @@ -3439,7 +3448,7 @@ StringToLine(PyObject *obj) } save[i] = '\0'; - PyString_FreeBytes(bytes); /* Python 2 does nothing here */ + Py_XDECREF(bytes); /* Python 2 does nothing here */ return save; } @@ -3568,10 +3577,10 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) return OK; } - else if (PyString_Check(line)) + else if (PyBytes_Check(line) || PyUnicode_Check(line)) { - char *save = StringToLine(line); - buf_T *savebuf; + char *save = StringToLine(line); + buf_T *savebuf; if (save == NULL) return FAIL; @@ -3821,7 +3830,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) /* First of all, we check the type of the supplied Python object. * It must be a string or a list, or the call is in error. */ - if (PyString_Check(lines)) + if (PyBytes_Check(lines) || PyUnicode_Check(lines)) { char *str = StringToLine(lines); buf_T *savebuf; @@ -5254,7 +5263,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) { char_u *result; - if (PyString_AsStringAndSize(obj, (char **) &result, NULL) == -1) + if (PyBytes_AsStringAndSize(obj, (char **) &result, NULL) == -1) return -1; if (result == NULL) return -1; @@ -5269,11 +5278,11 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) PyObject *bytes; char_u *result; - bytes = PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, NULL); + bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL); if (bytes == NULL) return -1; - if(PyString_AsStringAndSize(bytes, (char **) &result, NULL) == -1) + if(PyBytes_AsStringAndSize(bytes, (char **) &result, NULL) == -1) return -1; if (result == NULL) return -1; diff --git a/src/if_python.c b/src/if_python.c index 4a7c9d2589..ed51119912 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -68,12 +68,9 @@ #undef main /* Defined in python.h - aargh */ #undef HAVE_FCNTL_H /* Clash with os_win32.h */ -#define PyBytes_FromString PyString_FromString -#define PyBytes_Check PyString_Check - -/* No-op conversion functions, use with care! */ -#define PyString_AsBytes(obj) (obj) -#define PyString_FreeBytes(obj) +#define PyBytes_FromString PyString_FromString +#define PyBytes_Check PyString_Check +#define PyBytes_AsStringAndSize PyString_AsStringAndSize #if !defined(FEAT_PYTHON) && defined(PROTO) /* Use this to be able to generate prototypes without python being used. */ diff --git a/src/if_python3.c b/src/if_python3.c index d53d601fc0..9052e41597 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -84,13 +84,8 @@ #define PyInt Py_ssize_t #define PyString_Check(obj) PyUnicode_Check(obj) -#define PyString_AsBytes(obj) PyUnicode_AsEncodedString(obj, (char *)ENC_OPT, CODEC_ERROR_HANDLER) -#define PyString_FreeBytes(obj) Py_XDECREF(bytes) -#define PyString_AsString(obj) PyBytes_AsString(obj) -#define PyString_Size(obj) PyBytes_GET_SIZE(bytes) #define PyString_FromString(repr) PyUnicode_FromString(repr) #define PyString_FromFormat PyUnicode_FromFormat -#define PyString_AsStringAndSize(obj, buffer, len) PyBytes_AsStringAndSize(obj, buffer, len) #define PyInt_Check(obj) PyLong_Check(obj) #define PyInt_FromLong(i) PyLong_FromLong(i) #define PyInt_AsLong(obj) PyLong_AsLong(obj) @@ -357,7 +352,7 @@ static char* (*py3__PyUnicode_AsString)(PyObject *unicode); # endif static PyObject* (*py3_PyUnicode_AsEncodedString)(PyObject *unicode, const char* encoding, const char* errors); static char* (*py3_PyBytes_AsString)(PyObject *bytes); -static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, int *length); +static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, Py_ssize_t *length); static PyObject* (*py3_PyBytes_FromString)(char *str); static PyObject* (*py3_PyFloat_FromDouble)(double num); static double (*py3_PyFloat_AsDouble)(PyObject *); diff --git a/src/version.c b/src/version.c index 29a1b28161..2fc01b6679 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1228, /**/ 1227, /**/ From 4887e22aa8ba2db0363833d0c26fe960e4a34d50 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:11:18 +0200 Subject: [PATCH 10/20] Added tag v7-3-1228 for changeset 620d9b59d4ed --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 0748b274a4..b33b2a4dad 100644 --- a/.hgtags +++ b/.hgtags @@ -2564,3 +2564,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 27b008d5b7ac5fab02c6934b87f258bc4715aed6 v7-3-1225 b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 5cee875f30961cf1adadf386b7e2764ea8aeeb64 v7-3-1227 +620d9b59d4ed9deaac614c707c71257907b1dd21 v7-3-1228 From a45c0ac616ac95ea17aa9bf9f5b5bfae931ba02c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:28:17 +0200 Subject: [PATCH 11/20] updated for version 7.3.1229 Problem: Python: not so easy to delete/restore translating. Solution: Make macros do translation of exception messages. (ZyX) Note: this breaks translations! --- src/if_py_both.h | 211 ++++++++++++++++++++++++----------------------- src/if_python3.c | 12 +-- src/version.c | 2 + 3 files changed, 114 insertions(+), 111 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 71c30af41f..46625049d8 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -26,10 +26,12 @@ typedef int Py_ssize_t; /* Python 2.4 and earlier don't have this type. */ 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_SetString(PyExc_ValueError, \ - _("empty keys are not allowed")) +#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 @@ StringToChars(PyObject *object, PyObject **todecref) } else { - PyErr_SetString(PyExc_TypeError, _("object must be string")); + PyErr_SET_STRING(PyExc_TypeError, "object must be string"); return NULL; } @@ -212,8 +214,8 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) { 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 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) { 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 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) return 0; } - PyErr_SetString(PyExc_AttributeError, _("invalid attribute")); + PyErr_SET_STRING(PyExc_AttributeError, "invalid attribute"); return -1; } @@ -667,7 +669,7 @@ VimEval(PyObject *self UNUSED, PyObject *args) if (our_tv == NULL) { - PyErr_SetVim(_("invalid expression")); + PyErr_SET_VIM("invalid expression"); return NULL; } @@ -718,7 +720,7 @@ VimEvalPy(PyObject *self UNUSED, PyObject *string) if (our_tv == NULL) { - PyErr_SetVim(_("invalid expression")); + PyErr_SET_VIM("invalid expression"); return NULL; } @@ -790,7 +792,7 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) if (VimTryEnd()) return NULL; - PyErr_SetVim(_("failed to change directory")); + PyErr_SET_VIM("failed to change directory"); return NULL; } @@ -968,8 +970,8 @@ call_load_module(char *name, int len, PyObject *find_module_result) 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; } @@ -977,8 +979,8 @@ call_load_module(char *name, int len, PyObject *find_module_result) || !(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; } @@ -1349,8 +1351,8 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) { if (val == NULL) { - PyErr_SetString(PyExc_AttributeError, - _("cannot delete vim.Dictionary attributes")); + PyErr_SET_STRING(PyExc_AttributeError, + "cannot delete vim.Dictionary attributes"); return -1; } @@ -1358,7 +1360,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) { 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 @@ -1375,7 +1377,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) } else { - PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute")); + PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute"); return -1; } } @@ -1457,7 +1459,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) { if (dict->dv_lock) { - PyErr_SetVim(_("dict is locked")); + PyErr_SET_VIM("dict is locked"); Py_DECREF(r); return NULL; } @@ -1508,8 +1510,8 @@ DictionaryIterNext(dictiterinfo_T **dii) 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; } @@ -1560,7 +1562,7 @@ DictionaryAssItem( if (dict->dv_lock) { - PyErr_SetVim(_("dict is locked")); + PyErr_SET_VIM("dict is locked"); return -1; } @@ -1615,7 +1617,7 @@ DictionaryAssItem( 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; } } @@ -1723,7 +1725,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) if (dict->dv_lock) { - PyErr_SetVim(_("dict is locked")); + PyErr_SET_VIM("dict is locked"); return NULL; } @@ -1779,8 +1781,8 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) { 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; } @@ -1823,7 +1825,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) { 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; } } @@ -2021,8 +2023,8 @@ ListConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) 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; } @@ -2077,13 +2079,13 @@ ListItem(ListObject *self, Py_ssize_t index) 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); @@ -2196,12 +2198,12 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj) 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; } @@ -2222,7 +2224,7 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj) 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; } } @@ -2250,7 +2252,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj) if (l->lv_lock) { - PyErr_SetVim(_("list is locked")); + PyErr_SET_VIM("list is locked"); return -1; } @@ -2263,7 +2265,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj) 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) @@ -2296,7 +2298,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj) 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); @@ -2313,7 +2315,7 @@ ListConcatInPlace(ListObject *self, PyObject *obj) if (l->lv_lock) { - PyErr_SetVim(_("list is locked")); + PyErr_SET_VIM("list is locked"); return NULL; } @@ -2347,8 +2349,8 @@ ListSetattr(ListObject *self, char *name, PyObject *val) { if (val == NULL) { - PyErr_SetString(PyExc_AttributeError, - _("cannot delete vim.List attributes")); + PyErr_SET_STRING(PyExc_AttributeError, + "cannot delete vim.List attributes"); return -1; } @@ -2356,7 +2358,7 @@ ListSetattr(ListObject *self, char *name, PyObject *val) { 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 @@ -2373,7 +2375,7 @@ ListSetattr(ListObject *self, char *name, PyObject *val) } else { - PyErr_SetString(PyExc_AttributeError, _("cannot set this attribute")); + PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute"); return -1; } } @@ -2408,8 +2410,8 @@ FunctionNew(PyTypeObject *subtype, char_u *name) { 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); @@ -2420,7 +2422,7 @@ FunctionNew(PyTypeObject *subtype, char_u *name) 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; } @@ -2435,8 +2437,8 @@ FunctionConstructor(PyTypeObject *subtype, PyObject *args, PyObject *kwargs) 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; } @@ -2513,7 +2515,7 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) else if (error != OK) { result = NULL; - PyErr_SetVim(_("failed to run function")); + PyErr_SET_VIM("failed to run function"); } else result = ConvertToPyObject(&rettv); @@ -2658,14 +2660,14 @@ OptionsItem(OptionsObject *self, PyObject *keyObject) } 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; } } @@ -2708,7 +2710,7 @@ set_option_value_for( { 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); @@ -2768,15 +2770,14 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) { 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; } @@ -2813,7 +2814,7 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) 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; } @@ -2862,7 +2863,7 @@ CheckTabPage(TabPageObject *self) { 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; } @@ -3006,7 +3007,7 @@ TabListItem(PyObject *self UNUSED, PyInt n) 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 @@ CheckWindow(WindowObject *self) { 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 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) 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 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) 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 @@ WinListItem(WinListObject *self, PyInt n) 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 @@ StringToLine(PyObject *obj) --len; else { - PyErr_SetVim(_("string cannot contain newlines")); + PyErr_SET_VIM("string cannot contain newlines"); return NULL; } } @@ -3557,9 +3558,9 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) 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 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) 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 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha 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 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha 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 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha 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 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha 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 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha 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 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) 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 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) 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 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) 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 @@ CheckBuffer(BufferObject *self) { 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 @@ RBItem(BufferObject *self, PyInt n, PyInt start, PyInt end) 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 @@ RBAsItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyI 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 @@ RBAppend(BufferObject *self, PyObject *args, PyInt start, PyInt end, PyInt *new_ 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 @@ BufferSetattr(BufferObject *self, char *name, PyObject *valObject) if (r == FAIL) { - PyErr_SetVim(_("failed to rename buffer")); + PyErr_SET_VIM("failed to rename buffer"); return -1; } return 0; @@ -4416,8 +4417,8 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) 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 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) if (posp == NULL) { - PyErr_SetVim(_("invalid mark name")); + PyErr_SET_VIM("invalid mark name"); return NULL; } @@ -4529,7 +4530,7 @@ BufMapItem(PyObject *self UNUSED, PyObject *keyObject) 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { 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 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { 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 @@ pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) 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 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) 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 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv) 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 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) 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 @@ ConvertToPyObject(typval_T *tv) { if (tv == NULL) { - PyErr_SetVim(_("NULL reference passed")); + PyErr_SET_VIM("NULL reference passed"); return NULL; } switch (tv->v_type) @@ -5362,7 +5363,7 @@ ConvertToPyObject(typval_T *tv) 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 --git a/src/if_python3.c b/src/if_python3.c index 9052e41597..7155bc1c61 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -1169,7 +1169,7 @@ BufferSubscript(PyObject *self, PyObject* idx) } 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 @@ BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val) } 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 @@ RangeSubscript(PyObject *self, PyObject* idx) } 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 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val) } 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 @@ ListSubscript(PyObject *self, PyObject* idx) } 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 @@ ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj) } else { - PyErr_SetString(PyExc_TypeError, _("index must be int or slice")); + PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); return -1; } } diff --git a/src/version.c b/src/version.c index 2fc01b6679..bf9b2b318c 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1229, /**/ 1228, /**/ From 5163409008d5ddc613b2a4abd4fbd3d21948c8e6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:28:17 +0200 Subject: [PATCH 12/20] Added tag v7-3-1229 for changeset b6e693e1f946 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b33b2a4dad..f59e6bf3da 100644 --- a/.hgtags +++ b/.hgtags @@ -2565,3 +2565,4 @@ ba7db05e1482457a36b19ed608f820275fafb9f7 v7-3-1220 b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 5cee875f30961cf1adadf386b7e2764ea8aeeb64 v7-3-1227 620d9b59d4ed9deaac614c707c71257907b1dd21 v7-3-1228 +b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 From 83b5ab772ca63e9795c7023c11b6b3a5ce84b3f1 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:46:40 +0200 Subject: [PATCH 13/20] updated for version 7.3.1230 Problem: Python: Exception messages are not clear. Solution: Make exception messages more verbose. (ZyX) --- src/if_py_both.h | 152 +++++++++++++++++---------- src/if_python.c | 3 + src/if_python3.c | 15 +-- src/testdir/test86.ok | 236 +++++++++++++++++++++--------------------- src/testdir/test87.ok | 234 ++++++++++++++++++++--------------------- src/version.c | 2 + 6 files changed, 347 insertions(+), 295 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 46625049d8..e11c62e866 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -29,9 +29,25 @@ 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 PyErr_FORMAT(exc, str, tail) PyErr_Format(exc, _(str), tail) +#define PyErr_VIM_FORMAT(str, tail) PyErr_FORMAT(VimError, str, tail) + +#define Py_TYPE_NAME(obj) (obj->ob_type->tp_name == NULL \ + ? "(NULL)" \ + : obj->ob_type->tp_name) #define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \ "empty keys are not allowed") +#define RAISE_LOCKED(type) PyErr_SET_VIM(_(type " is locked")) +#define RAISE_LOCKED_DICTIONARY RAISE_LOCKED("dictionary") +#define RAISE_LOCKED_LIST RAISE_LOCKED("list") +#define RAISE_UNDO_FAIL PyErr_SET_VIM("cannot save undo information") +#define RAISE_LINE_FAIL(act) PyErr_SET_VIM("cannot " act " line") +#define RAISE_KEY_ADD_FAIL(key) \ + PyErr_VIM_FORMAT("failed to add key '%s' to dictionary", key) +#define RAISE_INVALID_INDEX_TYPE(idx) \ + PyErr_FORMAT(PyExc_TypeError, "index must be int or slice, not %s", \ + Py_TYPE_NAME(idx)); #define INVALID_BUFFER_VALUE ((buf_T *)(-1)) #define INVALID_WINDOW_VALUE ((win_T *)(-1)) @@ -122,7 +138,13 @@ StringToChars(PyObject *object, PyObject **todecref) } else { - PyErr_SET_STRING(PyExc_TypeError, "object must be string"); + PyErr_FORMAT(PyExc_TypeError, +#if PY_MAJOR_VERSION < 3 + "expected str() or unicode() instance, but got %s" +#else + "expected bytes() or str() instance, but got %s" +#endif + , Py_TYPE_NAME(object)); return NULL; } @@ -231,7 +253,7 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) return 0; } - PyErr_SET_STRING(PyExc_AttributeError, "invalid attribute"); + PyErr_FORMAT(PyExc_AttributeError, "invalid attribute: %s", name); return -1; } @@ -967,11 +989,19 @@ call_load_module(char *name, int len, PyObject *find_module_result) { PyObject *fd, *pathname, *description; - if (!PyTuple_Check(find_module_result) - || PyTuple_GET_SIZE(find_module_result) != 3) + if (!PyTuple_Check(find_module_result)) { - PyErr_SET_STRING(PyExc_TypeError, - "expected 3-tuple as imp.find_module() result"); + PyErr_FORMAT(PyExc_TypeError, + "expected 3-tuple as imp.find_module() result, but got %s", + Py_TYPE_NAME(find_module_result)); + return NULL; + } + if (PyTuple_GET_SIZE(find_module_result) != 3) + { + PyErr_FORMAT(PyExc_TypeError, + "expected 3-tuple as imp.find_module() result, but got " + "tuple of size %d", + (int) PyTuple_GET_SIZE(find_module_result)); return NULL; } @@ -1377,7 +1407,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) } else { - PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute"); + PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name); return -1; } } @@ -1459,7 +1489,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) { if (dict->dv_lock) { - PyErr_SET_VIM("dict is locked"); + RAISE_LOCKED_DICTIONARY; Py_DECREF(r); return NULL; } @@ -1562,7 +1592,7 @@ DictionaryAssItem( if (dict->dv_lock) { - PyErr_SET_VIM("dict is locked"); + RAISE_LOCKED_DICTIONARY; return -1; } @@ -1614,10 +1644,10 @@ DictionaryAssItem( if (dict_add(dict, di) == FAIL) { - Py_XDECREF(todecref); vim_free(di); dictitem_free(di); - PyErr_SET_VIM("failed to add key to dictionary"); + RAISE_KEY_ADD_FAIL(key); + Py_XDECREF(todecref); return -1; } } @@ -1725,7 +1755,7 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) if (dict->dv_lock) { - PyErr_SET_VIM("dict is locked"); + RAISE_LOCKED_DICTIONARY; return NULL; } @@ -1781,8 +1811,10 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) { Py_DECREF(iterator); Py_DECREF(fast); - PyErr_SET_STRING(PyExc_ValueError, - "expected sequence element of size 2"); + PyErr_FORMAT(PyExc_ValueError, + "expected sequence element of size 2, " + "but got sequence of size %d", + PySequence_Fast_GET_SIZE(fast)); return NULL; } @@ -1823,9 +1855,9 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) if (dict_add(dict, di) == FAIL) { + RAISE_KEY_ADD_FAIL(di->di_key); Py_DECREF(iterator); dictitem_free(di); - PyErr_SET_VIM("failed to add key to dictionary"); return NULL; } } @@ -2085,7 +2117,9 @@ ListItem(ListObject *self, Py_ssize_t index) li = list_find(self->list, (long) index); if (li == NULL) { - PyErr_SET_VIM("internal error: failed to get vim list item"); + /* No more suitable format specifications in python-2.3 */ + PyErr_VIM_FORMAT("internal error: failed to get vim list item %d", + (int) index); return NULL; } return ConvertToPyObject(&li->li_tv); @@ -2198,7 +2232,7 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj) if (l->lv_lock) { - PyErr_SET_VIM("list is locked"); + RAISE_LOCKED_LIST; return -1; } if (index>length || (index==length && obj==NULL)) @@ -2252,7 +2286,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj) if (l->lv_lock) { - PyErr_SET_VIM("list is locked"); + RAISE_LOCKED_LIST; return -1; } @@ -2265,7 +2299,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, Py_ssize_t last, PyObject *obj) li = list_find(l, (long) first); if (li == NULL) { - PyErr_SET_VIM("internal error: no vim list item"); + PyErr_VIM_FORMAT("internal error: no vim list item %d", (int)first); return -1; } if (last > first) @@ -2315,7 +2349,7 @@ ListConcatInPlace(ListObject *self, PyObject *obj) if (l->lv_lock) { - PyErr_SET_VIM("list is locked"); + RAISE_LOCKED_LIST; return NULL; } @@ -2375,7 +2409,7 @@ ListSetattr(ListObject *self, char *name, PyObject *val) } else { - PyErr_SET_STRING(PyExc_AttributeError, "cannot set this attribute"); + PyErr_FORMAT(PyExc_AttributeError, "cannot set attribute %s", name); return -1; } } @@ -2410,8 +2444,8 @@ FunctionNew(PyTypeObject *subtype, char_u *name) { if (!translated_function_exists(name)) { - PyErr_SET_STRING(PyExc_ValueError, - "unnamed function does not exist"); + PyErr_FORMAT(PyExc_ValueError, + "unnamed function %s does not exist", name); return NULL; } self->name = vim_strsave(name); @@ -2422,7 +2456,7 @@ FunctionNew(PyTypeObject *subtype, char_u *name) vim_strchr(name, AUTOLOAD_CHAR) == NULL)) == NULL) { - PyErr_SET_STRING(PyExc_ValueError, "function does not exist"); + PyErr_FORMAT(PyExc_ValueError, "function %s does not exist", name); return NULL; } @@ -2515,7 +2549,7 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) else if (error != OK) { result = NULL; - PyErr_SET_VIM("failed to run function"); + PyErr_VIM_FORMAT("failed to run function %s", (char *)name); } else result = ConvertToPyObject(&rettv); @@ -2770,14 +2804,16 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) { if (self->opt_type == SREQ_GLOBAL) { - PyErr_SET_STRING(PyExc_ValueError, "unable to unset global option"); + PyErr_FORMAT(PyExc_ValueError, + "unable to unset global option %s", key); Py_XDECREF(todecref); return -1; } else if (!(flags & SOPT_GLOBAL)) { - PyErr_SET_STRING(PyExc_ValueError, "unable to unset option " - "without global value"); + PyErr_FORMAT(PyExc_ValueError, + "unable to unset option %s " + "which does not have global value", key); Py_XDECREF(todecref); return -1; } @@ -3195,7 +3231,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) if (strcmp(name, "buffer") == 0) { - PyErr_SET_STRING(PyExc_TypeError, "readonly attribute"); + PyErr_SET_STRING(PyExc_TypeError, "readonly attribute: buffer"); return -1; } else if (strcmp(name, "cursor") == 0) @@ -3558,9 +3594,9 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) VimTryStart(); if (u_savedel((linenr_T)n, 1L) == FAIL) - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; else if (ml_delete((linenr_T)n, FALSE) == FAIL) - PyErr_SET_VIM("cannot delete line"); + RAISE_LINE_FAIL("delete"); else { if (buf == savebuf) @@ -3594,12 +3630,12 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) if (u_savesub((linenr_T)n) == FAIL) { - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; vim_free(save); } else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL) { - PyErr_SET_VIM("cannot replace line"); + RAISE_LINE_FAIL("replace"); vim_free(save); } else @@ -3654,14 +3690,14 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha switch_buffer(&savebuf, buf); if (u_savedel((linenr_T)lo, (long)n) == FAIL) - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; else { for (i = 0; i < n; ++i) { if (ml_delete((linenr_T)lo, FALSE) == FAIL) { - PyErr_SET_VIM("cannot delete line"); + RAISE_LINE_FAIL("delete"); break; } } @@ -3722,7 +3758,7 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha switch_buffer(&savebuf, buf); if (u_save((linenr_T)(lo-1), (linenr_T)hi) == FAIL) - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; /* 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 @@ -3733,7 +3769,7 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha for (i = 0; i < old_len - new_len; ++i) if (ml_delete((linenr_T)lo, FALSE) == FAIL) { - PyErr_SET_VIM("cannot delete line"); + RAISE_LINE_FAIL("delete"); break; } extra -= i; @@ -3749,7 +3785,7 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha if (ml_replace((linenr_T)(lo+i), (char_u *)array[i], FALSE) == FAIL) { - PyErr_SET_VIM("cannot replace line"); + RAISE_LINE_FAIL("replace"); break; } } @@ -3767,7 +3803,7 @@ SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_cha if (ml_append((linenr_T)(lo + i - 1), (char_u *)array[i], 0, FALSE) == FAIL) { - PyErr_SET_VIM("cannot insert line"); + RAISE_LINE_FAIL("insert"); break; } vim_free(array[i]); @@ -3844,9 +3880,9 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) switch_buffer(&savebuf, buf); if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL) - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL) - PyErr_SET_VIM("cannot insert line"); + RAISE_LINE_FAIL("insert"); else appended_lines_mark((linenr_T)n, 1L); @@ -3895,7 +3931,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) switch_buffer(&savebuf, buf); if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL) - PyErr_SET_VIM("cannot save undo information"); + RAISE_UNDO_FAIL; else { for (i = 0; i < size; ++i) @@ -3903,7 +3939,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) if (ml_append((linenr_T)(n + i), (char_u *)array[i], 0, FALSE) == FAIL) { - PyErr_SET_VIM("cannot insert line"); + RAISE_LINE_FAIL("insert"); /* Free the rest of the lines */ while (i < size) @@ -4668,7 +4704,9 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) if (value->ob_type != &BufferType) { - PyErr_SET_STRING(PyExc_TypeError, "expected vim.Buffer object"); + PyErr_FORMAT(PyExc_TypeError, + "expected vim.Buffer object, but got %s", + Py_TYPE_NAME(value)); return -1; } @@ -4681,7 +4719,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { if (VimTryEnd()) return -1; - PyErr_SET_VIM("failed to switch to given buffer"); + PyErr_VIM_FORMAT("failed to switch to buffer %d", count); return -1; } @@ -4693,7 +4731,9 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) if (value->ob_type != &WindowType) { - PyErr_SET_STRING(PyExc_TypeError, "expected vim.Window object"); + PyErr_FORMAT(PyExc_TypeError, + "expected vim.Window object, but got %s", + Py_TYPE_NAME(value)); return -1; } @@ -4725,7 +4765,9 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { if (value->ob_type != &TabPageType) { - PyErr_SET_STRING(PyExc_TypeError, "expected vim.TabPage object"); + PyErr_FORMAT(PyExc_TypeError, + "expected vim.TabPage object, but got %s", + Py_TYPE_NAME(value)); return -1; } @@ -5003,10 +5045,10 @@ pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) if (dict_add(dict, di) == FAIL) { + RAISE_KEY_ADD_FAIL(di->di_key); clear_tv(&di->di_tv); vim_free(di); dict_unref(dict); - PyErr_SET_VIM("failed to add key to dictionary"); return -1; } } @@ -5105,10 +5147,10 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) if (dict_add(dict, di) == FAIL) { + RAISE_KEY_ADD_FAIL(di->di_key); Py_DECREF(iterator); dictitem_free(di); dict_unref(dict); - PyErr_SET_VIM("failed to add key to dictionary"); return -1; } } @@ -5216,8 +5258,9 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv) r = convert_dl(obj, tv, pymap_to_tv, lookup_dict); else { - PyErr_SET_STRING(PyExc_TypeError, - "unable to convert object to vim dictionary"); + PyErr_FORMAT(PyExc_TypeError, + "unable to convert %s to vim dictionary", + Py_TYPE_NAME(obj)); r = -1; } Py_DECREF(lookup_dict); @@ -5326,8 +5369,9 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) return convert_dl(obj, tv, pymap_to_tv, lookup_dict); else { - PyErr_SET_STRING(PyExc_TypeError, - "unable to convert to vim structure"); + PyErr_FORMAT(PyExc_TypeError, + "unable to convert %s to vim structure", + Py_TYPE_NAME(obj)); return -1; } return 0; @@ -5338,7 +5382,7 @@ ConvertToPyObject(typval_T *tv) { if (tv == NULL) { - PyErr_SET_VIM("NULL reference passed"); + PyErr_SET_VIM("internal error: NULL reference passed"); return NULL; } switch (tv->v_type) diff --git a/src/if_python.c b/src/if_python.c index ed51119912..28cd36f853 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -160,6 +160,7 @@ struct PyMethodDef { Py_ssize_t a; }; # define PyErr_BadArgument dll_PyErr_BadArgument # define PyErr_NewException dll_PyErr_NewException # define PyErr_Clear dll_PyErr_Clear +# define PyErr_Format dll_PyErr_Format # define PyErr_PrintEx dll_PyErr_PrintEx # define PyErr_NoMemory dll_PyErr_NoMemory # define PyErr_Occurred dll_PyErr_Occurred @@ -301,6 +302,7 @@ static int(*dll_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item); static int(*dll_PyErr_BadArgument)(void); static PyObject *(*dll_PyErr_NewException)(char *, PyObject *, PyObject *); static void(*dll_PyErr_Clear)(void); +static PyObject*(*dll_PyErr_Format)(PyObject *, const char *, ...); static void(*dll_PyErr_PrintEx)(int); static PyObject*(*dll_PyErr_NoMemory)(void); static PyObject*(*dll_PyErr_Occurred)(void); @@ -473,6 +475,7 @@ static struct {"PyErr_BadArgument", (PYTHON_PROC*)&dll_PyErr_BadArgument}, {"PyErr_NewException", (PYTHON_PROC*)&dll_PyErr_NewException}, {"PyErr_Clear", (PYTHON_PROC*)&dll_PyErr_Clear}, + {"PyErr_Format", (PYTHON_PROC*)&dll_PyErr_Format}, {"PyErr_PrintEx", (PYTHON_PROC*)&dll_PyErr_PrintEx}, {"PyErr_NoMemory", (PYTHON_PROC*)&dll_PyErr_NoMemory}, {"PyErr_Occurred", (PYTHON_PROC*)&dll_PyErr_Occurred}, diff --git a/src/if_python3.c b/src/if_python3.c index 7155bc1c61..9bb2a4f7f5 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -122,6 +122,7 @@ # define PyDict_SetItemString py3_PyDict_SetItemString # define PyErr_BadArgument py3_PyErr_BadArgument # define PyErr_Clear py3_PyErr_Clear +# define PyErr_Format py3_PyErr_Format # define PyErr_PrintEx py3_PyErr_PrintEx # define PyErr_NoMemory py3_PyErr_NoMemory # define PyErr_Occurred py3_PyErr_Occurred @@ -337,6 +338,7 @@ static int (*py3_PyMem_Free)(void *); static void* (*py3_PyMem_Malloc)(size_t); static int (*py3_Py_IsInitialized)(void); static void (*py3_PyErr_Clear)(void); +static PyObject* (*py3_PyErr_Format)(PyObject *, const char *, ...); static void (*py3_PyErr_PrintEx)(int); static PyObject*(*py3__PyObject_Init)(PyObject *, PyTypeObject *); static iternextfunc py3__PyObject_NextNotImplemented; @@ -485,6 +487,7 @@ static struct {"_Py_FalseStruct", (PYTHON_PROC*)&py3__Py_FalseStruct}, {"_Py_TrueStruct", (PYTHON_PROC*)&py3__Py_TrueStruct}, {"PyErr_Clear", (PYTHON_PROC*)&py3_PyErr_Clear}, + {"PyErr_Format", (PYTHON_PROC*)&py3_PyErr_Format}, {"PyErr_PrintEx", (PYTHON_PROC*)&py3_PyErr_PrintEx}, {"PyObject_Init", (PYTHON_PROC*)&py3__PyObject_Init}, {"PyModule_AddObject", (PYTHON_PROC*)&py3_PyModule_AddObject}, @@ -1169,7 +1172,7 @@ BufferSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1203,7 +1206,7 @@ BufferAsSubscript(PyObject *self, PyObject* idx, PyObject* val) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } @@ -1285,7 +1288,7 @@ RangeSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1312,7 +1315,7 @@ RangeAsSubscript(PyObject *self, PyObject *idx, PyObject *val) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } @@ -1491,7 +1494,7 @@ ListSubscript(PyObject *self, PyObject* idx) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return NULL; } } @@ -1515,7 +1518,7 @@ ListAsSubscript(PyObject *self, PyObject *idx, PyObject *obj) } else { - PyErr_SET_STRING(PyExc_TypeError, "index must be int or slice"); + RAISE_INVALID_INDEX_TYPE(idx); return -1; } } diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index 27a1372333..d94e0eaf77 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -439,106 +439,106 @@ test86.in >> OutputSetattr del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",) sys.stdout.softspace = []:TypeError:('softspace must be an integer',) -sys.stdout.attr = None:AttributeError:('invalid attribute',) +sys.stdout.attr = None:AttributeError:('invalid attribute: attr',) >> OutputWrite sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) >> OutputWriteLines sys.stdout.writelines(None):TypeError:("'NoneType' object is not iterable",) sys.stdout.writelines([1]):TypeError:('coercing to Unicode: need string or buffer, int found',) > VimCommand -vim.command(1):TypeError:('object must be string',) +vim.command(1):TypeError:('expected str() or unicode() instance, but got int',) > VimToPython > VimEval -vim.eval(1):TypeError:('object must be string',) +vim.eval(1):TypeError:('expected str() or unicode() instance, but got int',) > VimEvalPy -vim.bindeval(1):TypeError:('object must be string',) +vim.bindeval(1):TypeError:('expected str() or unicode() instance, but got int',) > VimStrwidth -vim.strwidth(1):TypeError:('object must be string',) +vim.strwidth(1):TypeError:('expected str() or unicode() instance, but got int',) > Dictionary >> DictionaryConstructor -vim.Dictionary("abc"):ValueError:('expected sequence element of size 2',) +vim.Dictionary("abc"):ValueError:('expected sequence element of size 2, but got sequence of size 1',) >> DictionarySetattr del d.locked:AttributeError:('cannot delete vim.Dictionary attributes',) d.locked = FailingTrue():NotImplementedError:() vim.vvars.locked = False:TypeError:('cannot modify fixed dictionary',) -d.scope = True:AttributeError:('cannot set this attribute',) -d.xxx = True:AttributeError:('cannot set this attribute',) +d.scope = True:AttributeError:('cannot set attribute scope',) +d.xxx = True:AttributeError:('cannot set attribute xxx',) >> _DictionaryItem d.get("a", 2, 3):TypeError:('function takes at most 2 arguments (3 given)',) >>> Testing StringToChars using d.get(%s) -d.get(1):TypeError:('object must be string',) +d.get(1):TypeError:('expected str() or unicode() instance, but got int',) d.get(u"\0"):TypeError:('expected string without null bytes',) d.get("\0"):TypeError:('expected string without null bytes',) <<< Finished d.pop("a"):KeyError:('a',) -dl.pop("a"):error:('dict is locked',) +dl.pop("a"):error:('dictionary is locked',) >> DictionaryIterNext for i in ned: ned["a"] = 1:RuntimeError:('hashtab changed during iteration',) >> DictionaryAssItem -dl["b"] = 1:error:('dict is locked',) +dl["b"] = 1:error:('dictionary is locked',) >>> Testing StringToChars using d[%s] = 1 -d[1] = 1:TypeError:('object must be string',) +d[1] = 1:TypeError:('expected str() or unicode() instance, but got int',) d[u"\0"] = 1:TypeError:('expected string without null bytes',) d["\0"] = 1:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d["a"] = {%s : 1} -d["a"] = {1 : 1}:TypeError:('object must be string',) +d["a"] = {1 : 1}:TypeError:('expected str() or unicode() instance, but got int',) d["a"] = {u"\0" : 1}:TypeError:('expected string without null bytes',) d["a"] = {"\0" : 1}:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}} -d["a"] = {"abc" : {1 : 1}}:TypeError:('object must be string',) +d["a"] = {"abc" : {1 : 1}}:TypeError:('expected str() or unicode() instance, but got int',) d["a"] = {"abc" : {u"\0" : 1}}:TypeError:('expected string without null bytes',) d["a"] = {"abc" : {"\0" : 1}}:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})} -d["a"] = {"abc" : Mapping({1 : 1})}:TypeError:('object must be string',) +d["a"] = {"abc" : Mapping({1 : 1})}:TypeError:('expected str() or unicode() instance, but got int',) d["a"] = {"abc" : Mapping({u"\0" : 1})}:TypeError:('expected string without null bytes',) d["a"] = {"abc" : Mapping({"\0" : 1})}:TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d["a"] = {"abc" : %s} -d["a"] = {"abc" : FailingIter()}:TypeError:('unable to convert to vim structure',) +d["a"] = {"abc" : FailingIter()}:TypeError:('unable to convert FailingIter to vim structure',) d["a"] = {"abc" : FailingIterNext()}:NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s} -d["a"] = {"abc" : None}:TypeError:('unable to convert to vim structure',) +d["a"] = {"abc" : None}:TypeError:('unable to convert NoneType to vim structure',) d["a"] = {"abc" : {"": 1}}:ValueError:('empty keys are not allowed',) d["a"] = {"abc" : {u"": 1}}:ValueError:('empty keys are not allowed',) d["a"] = {"abc" : FailingMapping()}:NotImplementedError:() d["a"] = {"abc" : FailingMappingKey()}:NotImplementedError:() <<< Finished >>> Testing StringToChars using d["a"] = Mapping({%s : 1}) -d["a"] = Mapping({1 : 1}):TypeError:('object must be string',) +d["a"] = Mapping({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) d["a"] = Mapping({u"\0" : 1}):TypeError:('expected string without null bytes',) d["a"] = Mapping({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}}) -d["a"] = Mapping({"abc" : {1 : 1}}):TypeError:('object must be string',) +d["a"] = Mapping({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) d["a"] = Mapping({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) d["a"] = Mapping({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})}) -d["a"] = Mapping({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',) +d["a"] = Mapping({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) d["a"] = Mapping({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',) +d["a"] = Mapping({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) d["a"] = Mapping({"abc" : FailingIterNext()}):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : None}):TypeError:('unable to convert to vim structure',) +d["a"] = Mapping({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) d["a"] = Mapping({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) d["a"] = Mapping({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) d["a"] = Mapping({"abc" : FailingMapping()}):NotImplementedError:() d["a"] = Mapping({"abc" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing *Iter* using d["a"] = %s -d["a"] = FailingIter():TypeError:('unable to convert to vim structure',) +d["a"] = FailingIter():TypeError:('unable to convert FailingIter to vim structure',) d["a"] = FailingIterNext():NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d["a"] = %s -d["a"] = None:TypeError:('unable to convert to vim structure',) +d["a"] = None:TypeError:('unable to convert NoneType to vim structure',) d["a"] = {"": 1}:ValueError:('empty keys are not allowed',) d["a"] = {u"": 1}:ValueError:('empty keys are not allowed',) d["a"] = FailingMapping():NotImplementedError:() @@ -550,52 +550,52 @@ d["a"] = FailingMappingKey():NotImplementedError:() d.update(FailingMapping()):NotImplementedError:() d.update([FailingIterNext()]):NotImplementedError:() >>> Testing StringToChars using d.update({%s : 1}) -d.update({1 : 1}):TypeError:('object must be string',) +d.update({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) d.update({u"\0" : 1}):TypeError:('expected string without null bytes',) d.update({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update({"abc" : {%s : 1}}) -d.update({"abc" : {1 : 1}}):TypeError:('object must be string',) +d.update({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) d.update({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) d.update({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})}) -d.update({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',) +d.update({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) d.update({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) d.update({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d.update({"abc" : %s}) -d.update({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',) +d.update({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) d.update({"abc" : FailingIterNext()}):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d.update({"abc" : %s}) -d.update({"abc" : None}):TypeError:('unable to convert to vim structure',) +d.update({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) d.update({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) d.update({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) d.update({"abc" : FailingMapping()}):NotImplementedError:() d.update({"abc" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using d.update(Mapping({%s : 1})) -d.update(Mapping({1 : 1})):TypeError:('object must be string',) +d.update(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) d.update(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) d.update(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}})) -d.update(Mapping({"abc" : {1 : 1}})):TypeError:('object must be string',) +d.update(Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) d.update(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) d.update(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})})) -d.update(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('object must be string',) +d.update(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) d.update(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) d.update(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert to vim structure',) +d.update(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) d.update(Mapping({"abc" : FailingIterNext()})):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : None})):TypeError:('unable to convert to vim structure',) +d.update(Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) d.update(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) d.update(Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) d.update(Mapping({"abc" : FailingMapping()})):NotImplementedError:() @@ -613,68 +613,68 @@ d.update(FailingMapping()):NotImplementedError:() d.update(FailingMappingKey()):NotImplementedError:() <<< Finished >>> Testing StringToChars using d.update(((%s, 0),)) -d.update(((1, 0),)):TypeError:('object must be string',) +d.update(((1, 0),)):TypeError:('expected str() or unicode() instance, but got int',) d.update(((u"\0", 0),)):TypeError:('expected string without null bytes',) d.update((("\0", 0),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update((("a", {%s : 1}),)) -d.update((("a", {1 : 1}),)):TypeError:('object must be string',) +d.update((("a", {1 : 1}),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", {u"\0" : 1}),)):TypeError:('expected string without null bytes',) d.update((("a", {"\0" : 1}),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),)) -d.update((("a", {"abc" : {1 : 1}}),)):TypeError:('object must be string',) +d.update((("a", {"abc" : {1 : 1}}),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", {"abc" : {u"\0" : 1}}),)):TypeError:('expected string without null bytes',) d.update((("a", {"abc" : {"\0" : 1}}),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),)) -d.update((("a", {"abc" : Mapping({1 : 1})}),)):TypeError:('object must be string',) +d.update((("a", {"abc" : Mapping({1 : 1})}),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", {"abc" : Mapping({u"\0" : 1})}),)):TypeError:('expected string without null bytes',) d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : FailingIter()}),)):TypeError:('unable to convert to vim structure',) +d.update((("a", {"abc" : FailingIter()}),)):TypeError:('unable to convert FailingIter to vim structure',) d.update((("a", {"abc" : FailingIterNext()}),)):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : None}),)):TypeError:('unable to convert to vim structure',) +d.update((("a", {"abc" : None}),)):TypeError:('unable to convert NoneType to vim structure',) d.update((("a", {"abc" : {"": 1}}),)):ValueError:('empty keys are not allowed',) d.update((("a", {"abc" : {u"": 1}}),)):ValueError:('empty keys are not allowed',) d.update((("a", {"abc" : FailingMapping()}),)):NotImplementedError:() d.update((("a", {"abc" : FailingMappingKey()}),)):NotImplementedError:() <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),)) -d.update((("a", Mapping({1 : 1})),)):TypeError:('object must be string',) +d.update((("a", Mapping({1 : 1})),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", Mapping({u"\0" : 1})),)):TypeError:('expected string without null bytes',) d.update((("a", Mapping({"\0" : 1})),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),)) -d.update((("a", Mapping({"abc" : {1 : 1}})),)):TypeError:('object must be string',) +d.update((("a", Mapping({"abc" : {1 : 1}})),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", Mapping({"abc" : {u"\0" : 1}})),)):TypeError:('expected string without null bytes',) d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),)) -d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):TypeError:('object must be string',) +d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", Mapping({"abc" : Mapping({u"\0" : 1})})),)):TypeError:('expected string without null bytes',) d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : FailingIter()})),)):TypeError:('unable to convert to vim structure',) +d.update((("a", Mapping({"abc" : FailingIter()})),)):TypeError:('unable to convert FailingIter to vim structure',) d.update((("a", Mapping({"abc" : FailingIterNext()})),)):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : None})),)):TypeError:('unable to convert to vim structure',) +d.update((("a", Mapping({"abc" : None})),)):TypeError:('unable to convert NoneType to vim structure',) d.update((("a", Mapping({"abc" : {"": 1}})),)):ValueError:('empty keys are not allowed',) d.update((("a", Mapping({"abc" : {u"": 1}})),)):ValueError:('empty keys are not allowed',) d.update((("a", Mapping({"abc" : FailingMapping()})),)):NotImplementedError:() d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):NotImplementedError:() <<< Finished >>> Testing *Iter* using d.update((("a", %s),)) -d.update((("a", FailingIter()),)):TypeError:('unable to convert to vim structure',) +d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to vim structure',) d.update((("a", FailingIterNext()),)):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", %s),)) -d.update((("a", None),)):TypeError:('unable to convert to vim structure',) +d.update((("a", None),)):TypeError:('unable to convert NoneType to vim structure',) d.update((("a", {"": 1}),)):ValueError:('empty keys are not allowed',) d.update((("a", {u"": 1}),)):ValueError:('empty keys are not allowed',) d.update((("a", FailingMapping()),)):NotImplementedError:() @@ -689,63 +689,63 @@ d.has_key():TypeError:('has_key() takes exactly one argument (0 given)',) vim.List(1, 2):TypeError:('function takes at most 1 argument (2 given)',) vim.List(a=1):TypeError:('list constructor does not accept keyword arguments',) >>> Testing StringToChars using vim.List([{%s : 1}]) -vim.List([{1 : 1}]):TypeError:('object must be string',) +vim.List([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',) vim.List([{"\0" : 1}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}]) -vim.List([{"abc" : {1 : 1}}]):TypeError:('object must be string',) +vim.List([{"abc" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) vim.List([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}]) -vim.List([{"abc" : Mapping({1 : 1})}]):TypeError:('object must be string',) +vim.List([{"abc" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) vim.List([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using vim.List([{"abc" : %s}]) -vim.List([{"abc" : FailingIter()}]):TypeError:('unable to convert to vim structure',) +vim.List([{"abc" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) vim.List([{"abc" : FailingIterNext()}]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using vim.List([{"abc" : %s}]) -vim.List([{"abc" : None}]):TypeError:('unable to convert to vim structure',) +vim.List([{"abc" : None}]):TypeError:('unable to convert NoneType to vim structure',) vim.List([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',) vim.List([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',) vim.List([{"abc" : FailingMapping()}]):NotImplementedError:() vim.List([{"abc" : FailingMappingKey()}]):NotImplementedError:() <<< Finished >>> Testing StringToChars using vim.List([Mapping({%s : 1})]) -vim.List([Mapping({1 : 1})]):TypeError:('object must be string',) +vim.List([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',) vim.List([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})]) -vim.List([Mapping({"abc" : {1 : 1}})]):TypeError:('object must be string',) +vim.List([Mapping({"abc" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) vim.List([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})]) -vim.List([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('object must be string',) +vim.List([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert to vim structure',) +vim.List([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) vim.List([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : None})]):TypeError:('unable to convert to vim structure',) +vim.List([Mapping({"abc" : None})]):TypeError:('unable to convert NoneType to vim structure',) vim.List([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',) vim.List([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',) vim.List([Mapping({"abc" : FailingMapping()})]):NotImplementedError:() vim.List([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:() <<< Finished >>> Testing *Iter* using vim.List([%s]) -vim.List([FailingIter()]):TypeError:('unable to convert to vim structure',) +vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',) vim.List([FailingIterNext()]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using vim.List([%s]) -vim.List([None]):TypeError:('unable to convert to vim structure',) +vim.List([None]):TypeError:('unable to convert NoneType to vim structure',) vim.List([{"": 1}]):ValueError:('empty keys are not allowed',) vim.List([{u"": 1}]):ValueError:('empty keys are not allowed',) vim.List([FailingMapping()]):NotImplementedError:() @@ -759,63 +759,63 @@ l[1000] = 3:IndexError:('list index out of range',) >> ListAssSlice ll[1:100] = "abc":error:('list is locked',) >>> Testing StringToChars using l[:] = [{%s : 1}] -l[:] = [{1 : 1}]:TypeError:('object must be string',) +l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',) l[:] = [{"\0" : 1}]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}] -l[:] = [{"abc" : {1 : 1}}]:TypeError:('object must be string',) +l[:] = [{"abc" : {1 : 1}}]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [{"abc" : {u"\0" : 1}}]:TypeError:('expected string without null bytes',) l[:] = [{"abc" : {"\0" : 1}}]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}] -l[:] = [{"abc" : Mapping({1 : 1})}]:TypeError:('object must be string',) +l[:] = [{"abc" : Mapping({1 : 1})}]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [{"abc" : Mapping({u"\0" : 1})}]:TypeError:('expected string without null bytes',) l[:] = [{"abc" : Mapping({"\0" : 1})}]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : FailingIter()}]:TypeError:('unable to convert to vim structure',) +l[:] = [{"abc" : FailingIter()}]:TypeError:('unable to convert FailingIter to vim structure',) l[:] = [{"abc" : FailingIterNext()}]:NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : None}]:TypeError:('unable to convert to vim structure',) +l[:] = [{"abc" : None}]:TypeError:('unable to convert NoneType to vim structure',) l[:] = [{"abc" : {"": 1}}]:ValueError:('empty keys are not allowed',) l[:] = [{"abc" : {u"": 1}}]:ValueError:('empty keys are not allowed',) l[:] = [{"abc" : FailingMapping()}]:NotImplementedError:() l[:] = [{"abc" : FailingMappingKey()}]:NotImplementedError:() <<< Finished >>> Testing StringToChars using l[:] = [Mapping({%s : 1})] -l[:] = [Mapping({1 : 1})]:TypeError:('object must be string',) +l[:] = [Mapping({1 : 1})]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [Mapping({u"\0" : 1})]:TypeError:('expected string without null bytes',) l[:] = [Mapping({"\0" : 1})]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})] -l[:] = [Mapping({"abc" : {1 : 1}})]:TypeError:('object must be string',) +l[:] = [Mapping({"abc" : {1 : 1}})]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [Mapping({"abc" : {u"\0" : 1}})]:TypeError:('expected string without null bytes',) l[:] = [Mapping({"abc" : {"\0" : 1}})]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})] -l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:TypeError:('object must be string',) +l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [Mapping({"abc" : Mapping({u"\0" : 1})})]:TypeError:('expected string without null bytes',) l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : FailingIter()})]:TypeError:('unable to convert to vim structure',) +l[:] = [Mapping({"abc" : FailingIter()})]:TypeError:('unable to convert FailingIter to vim structure',) l[:] = [Mapping({"abc" : FailingIterNext()})]:NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : None})]:TypeError:('unable to convert to vim structure',) +l[:] = [Mapping({"abc" : None})]:TypeError:('unable to convert NoneType to vim structure',) l[:] = [Mapping({"abc" : {"": 1}})]:ValueError:('empty keys are not allowed',) l[:] = [Mapping({"abc" : {u"": 1}})]:ValueError:('empty keys are not allowed',) l[:] = [Mapping({"abc" : FailingMapping()})]:NotImplementedError:() l[:] = [Mapping({"abc" : FailingMappingKey()})]:NotImplementedError:() <<< Finished >>> Testing *Iter* using l[:] = [%s] -l[:] = [FailingIter()]:TypeError:('unable to convert to vim structure',) +l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to vim structure',) l[:] = [FailingIterNext()]:NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l[:] = [%s] -l[:] = [None]:TypeError:('unable to convert to vim structure',) +l[:] = [None]:TypeError:('unable to convert NoneType to vim structure',) l[:] = [{"": 1}]:ValueError:('empty keys are not allowed',) l[:] = [{u"": 1}]:ValueError:('empty keys are not allowed',) l[:] = [FailingMapping()]:NotImplementedError:() @@ -823,63 +823,63 @@ l[:] = [FailingMappingKey()]:NotImplementedError:() <<< Finished >> ListConcatInPlace >>> Testing StringToChars using l.extend([{%s : 1}]) -l.extend([{1 : 1}]):TypeError:('object must be string',) +l.extend([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',) l.extend([{"\0" : 1}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}]) -l.extend([{"abc" : {1 : 1}}]):TypeError:('object must be string',) +l.extend([{"abc" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) l.extend([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}]) -l.extend([{"abc" : Mapping({1 : 1})}]):TypeError:('object must be string',) +l.extend([{"abc" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) l.extend([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using l.extend([{"abc" : %s}]) -l.extend([{"abc" : FailingIter()}]):TypeError:('unable to convert to vim structure',) +l.extend([{"abc" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) l.extend([{"abc" : FailingIterNext()}]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l.extend([{"abc" : %s}]) -l.extend([{"abc" : None}]):TypeError:('unable to convert to vim structure',) +l.extend([{"abc" : None}]):TypeError:('unable to convert NoneType to vim structure',) l.extend([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',) l.extend([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',) l.extend([{"abc" : FailingMapping()}]):NotImplementedError:() l.extend([{"abc" : FailingMappingKey()}]):NotImplementedError:() <<< Finished >>> Testing StringToChars using l.extend([Mapping({%s : 1})]) -l.extend([Mapping({1 : 1})]):TypeError:('object must be string',) +l.extend([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',) l.extend([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})]) -l.extend([Mapping({"abc" : {1 : 1}})]):TypeError:('object must be string',) +l.extend([Mapping({"abc" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) l.extend([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})]) -l.extend([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('object must be string',) +l.extend([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert to vim structure',) +l.extend([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) l.extend([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : None})]):TypeError:('unable to convert to vim structure',) +l.extend([Mapping({"abc" : None})]):TypeError:('unable to convert NoneType to vim structure',) l.extend([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',) l.extend([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',) l.extend([Mapping({"abc" : FailingMapping()})]):NotImplementedError:() l.extend([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:() <<< Finished >>> Testing *Iter* using l.extend([%s]) -l.extend([FailingIter()]):TypeError:('unable to convert to vim structure',) +l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',) l.extend([FailingIterNext()]):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using l.extend([%s]) -l.extend([None]):TypeError:('unable to convert to vim structure',) +l.extend([None]):TypeError:('unable to convert NoneType to vim structure',) l.extend([{"": 1}]):ValueError:('empty keys are not allowed',) l.extend([{u"": 1}]):ValueError:('empty keys are not allowed',) l.extend([FailingMapping()]):NotImplementedError:() @@ -888,141 +888,141 @@ l.extend([FailingMappingKey()]):NotImplementedError:() >> ListSetattr del l.locked:AttributeError:('cannot delete vim.List attributes',) l.locked = FailingTrue():NotImplementedError:() -l.xxx = True:AttributeError:('cannot set this attribute',) +l.xxx = True:AttributeError:('cannot set attribute xxx',) > Function >> FunctionConstructor -vim.Function("123"):ValueError:('unnamed function does not exist',) -vim.Function("xxx_non_existent_function_xxx"):ValueError:('function does not exist',) +vim.Function("123"):ValueError:('unnamed function 123 does not exist',) +vim.Function("xxx_non_existent_function_xxx"):ValueError:('function xxx_non_existent_function_xxx does not exist',) vim.Function("xxx#non#existent#function#xxx"):NOT FAILED >> FunctionCall >>> Testing StringToChars using f({%s : 1}) -f({1 : 1}):TypeError:('object must be string',) +f({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) f({u"\0" : 1}):TypeError:('expected string without null bytes',) f({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using f({"abc" : {%s : 1}}) -f({"abc" : {1 : 1}}):TypeError:('object must be string',) +f({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) f({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) f({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using f({"abc" : Mapping({%s : 1})}) -f({"abc" : Mapping({1 : 1})}):TypeError:('object must be string',) +f({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) f({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) f({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using f({"abc" : %s}) -f({"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',) +f({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) f({"abc" : FailingIterNext()}):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using f({"abc" : %s}) -f({"abc" : None}):TypeError:('unable to convert to vim structure',) +f({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) f({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) f({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) f({"abc" : FailingMapping()}):NotImplementedError:() f({"abc" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using f(Mapping({%s : 1})) -f(Mapping({1 : 1})):TypeError:('object must be string',) +f(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) f(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) f(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}})) -f(Mapping({"abc" : {1 : 1}})):TypeError:('object must be string',) +f(Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) f(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) f(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})})) -f(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('object must be string',) +f(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) f(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) f(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert to vim structure',) +f(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) f(Mapping({"abc" : FailingIterNext()})):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : None})):TypeError:('unable to convert to vim structure',) +f(Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) f(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) f(Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) f(Mapping({"abc" : FailingMapping()})):NotImplementedError:() f(Mapping({"abc" : FailingMappingKey()})):NotImplementedError:() <<< Finished >>> Testing *Iter* using f(%s) -f(FailingIter()):TypeError:('unable to convert to vim structure',) +f(FailingIter()):TypeError:('unable to convert FailingIter to vim structure',) f(FailingIterNext()):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using f(%s) -f(None):TypeError:('unable to convert to vim structure',) +f(None):TypeError:('unable to convert NoneType to vim structure',) f({"": 1}):ValueError:('empty keys are not allowed',) f({u"": 1}):ValueError:('empty keys are not allowed',) f(FailingMapping()):NotImplementedError:() f(FailingMappingKey()):NotImplementedError:() <<< Finished >>> Testing StringToChars using fd(self={%s : 1}) -fd(self={1 : 1}):TypeError:('object must be string',) +fd(self={1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) fd(self={u"\0" : 1}):TypeError:('expected string without null bytes',) fd(self={"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using fd(self={"abc" : {%s : 1}}) -fd(self={"abc" : {1 : 1}}):TypeError:('object must be string',) +fd(self={"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) fd(self={"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) fd(self={"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})}) -fd(self={"abc" : Mapping({1 : 1})}):TypeError:('object must be string',) +fd(self={"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) fd(self={"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) fd(self={"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using fd(self={"abc" : %s}) -fd(self={"abc" : FailingIter()}):TypeError:('unable to convert to vim structure',) +fd(self={"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) fd(self={"abc" : FailingIterNext()}):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using fd(self={"abc" : %s}) -fd(self={"abc" : None}):TypeError:('unable to convert to vim structure',) +fd(self={"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) fd(self={"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) fd(self={"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) fd(self={"abc" : FailingMapping()}):NotImplementedError:() fd(self={"abc" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using fd(self=Mapping({%s : 1})) -fd(self=Mapping({1 : 1})):TypeError:('object must be string',) +fd(self=Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) fd(self=Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) fd(self=Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}})) -fd(self=Mapping({"abc" : {1 : 1}})):TypeError:('object must be string',) +fd(self=Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) fd(self=Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) fd(self=Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})})) -fd(self=Mapping({"abc" : Mapping({1 : 1})})):TypeError:('object must be string',) +fd(self=Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) fd(self=Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished >>> Testing *Iter* using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : FailingIter()})):TypeError:('unable to convert to vim structure',) +fd(self=Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) fd(self=Mapping({"abc" : FailingIterNext()})):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyObject using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : None})):TypeError:('unable to convert to vim structure',) +fd(self=Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) fd(self=Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) fd(self=Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) fd(self=Mapping({"abc" : FailingMapping()})):NotImplementedError:() fd(self=Mapping({"abc" : FailingMappingKey()})):NotImplementedError:() <<< Finished >>> Testing *Iter* using fd(self=%s) -fd(self=FailingIter()):TypeError:('unable to convert object to vim dictionary',) -fd(self=FailingIterNext()):TypeError:('unable to convert object to vim dictionary',) +fd(self=FailingIter()):TypeError:('unable to convert FailingIter to vim dictionary',) +fd(self=FailingIterNext()):TypeError:('unable to convert FailingIterNext to vim dictionary',) <<< Finished >>> Testing ConvertFromPyObject using fd(self=%s) -fd(self=None):TypeError:('unable to convert object to vim dictionary',) +fd(self=None):TypeError:('unable to convert NoneType to vim dictionary',) fd(self={"": 1}):ValueError:('empty keys are not allowed',) fd(self={u"": 1}):ValueError:('empty keys are not allowed',) fd(self=FailingMapping()):NotImplementedError:() fd(self=FailingMappingKey()):NotImplementedError:() <<< Finished >>> Testing ConvertFromPyMapping using fd(self=%s) -fd(self=[]):TypeError:('unable to convert object to vim dictionary',) +fd(self=[]):TypeError:('unable to convert list to vim dictionary',) <<< Finished > TabPage >> TabPageAttr @@ -1034,7 +1034,7 @@ vim.tabpages[1000]:IndexError:('no such tab page',) >> WindowAttr vim.current.window.xxx:AttributeError:('xxx',) >> WindowSetattr -vim.current.window.buffer = 0:TypeError:('readonly attribute',) +vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',) vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',) vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',) vim.current.window.height = "abc":TypeError:('an integer is required',) @@ -1062,10 +1062,10 @@ vim.current.buffer[100000000] = "":IndexError:('line number out of range',) >> BufferAttr vim.current.buffer.xxx:AttributeError:('xxx',) >> BufferSetattr -vim.current.buffer.name = True:TypeError:('object must be string',) +vim.current.buffer.name = True:TypeError:('expected str() or unicode() instance, but got bool',) vim.current.buffer.xxx = True:AttributeError:('xxx',) >> BufferMark -vim.current.buffer.mark(0):TypeError:('object must be string',) +vim.current.buffer.mark(0):TypeError:('expected str() or unicode() instance, but got int',) vim.current.buffer.mark("abc"):ValueError:('mark name must be a single character',) vim.current.buffer.mark("!"):error:('invalid mark name',) >> BufferRange @@ -1079,9 +1079,9 @@ vim.buffers[100000000]:KeyError:(100000000,) vim.current.xxx:AttributeError:('xxx',) >> CurrentSetattr vim.current.line = True:TypeError:('bad argument type for built-in operation',) -vim.current.buffer = True:TypeError:('expected vim.Buffer object',) -vim.current.window = True:TypeError:('expected vim.Window object',) -vim.current.tabpage = True:TypeError:('expected vim.TabPage object',) +vim.current.buffer = True:TypeError:('expected vim.Buffer object, but got bool',) +vim.current.window = True:TypeError:('expected vim.Window object, but got bool',) +vim.current.tabpage = True:TypeError:('expected vim.TabPage object, but got bool',) vim.current.xxx = True:AttributeError:('xxx',) 2,xx before diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 7ee1a1ca2b..4b730349bc 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -428,7 +428,7 @@ test87.in >> OutputSetattr del sys.stdout.softspace:(, AttributeError("can't delete OutputObject attributes",)) sys.stdout.softspace = []:(, TypeError('softspace must be an integer',)) -sys.stdout.attr = None:(, AttributeError('invalid attribute',)) +sys.stdout.attr = None:(, AttributeError('invalid attribute: attr',)) >> OutputWrite sys.stdout.write(None):(, TypeError("Can't convert 'NoneType' object to str implicitly",)) >> OutputWriteLines @@ -439,99 +439,99 @@ sys.stdout.writelines(FailingIter()):(, NotImplemen sys.stdout.writelines(FailingIterNext()):(, NotImplementedError()) <<< Finished > VimCommand -vim.command(1):(, TypeError('object must be string',)) +vim.command(1):(, TypeError('expected bytes() or str() instance, but got int',)) > VimToPython > VimEval -vim.eval(1):(, TypeError('object must be string',)) +vim.eval(1):(, TypeError('expected bytes() or str() instance, but got int',)) > VimEvalPy -vim.bindeval(1):(, TypeError('object must be string',)) +vim.bindeval(1):(, TypeError('expected bytes() or str() instance, but got int',)) > VimStrwidth -vim.strwidth(1):(, TypeError('object must be string',)) +vim.strwidth(1):(, TypeError('expected bytes() or str() instance, but got int',)) > Dictionary >> DictionaryConstructor -vim.Dictionary("abc"):(, ValueError('expected sequence element of size 2',)) +vim.Dictionary("abc"):(, ValueError('expected sequence element of size 2, but got sequence of size 1',)) >> DictionarySetattr del d.locked:(, AttributeError('cannot delete vim.Dictionary attributes',)) d.locked = FailingTrue():(, NotImplementedError()) vim.vvars.locked = False:(, TypeError('cannot modify fixed dictionary',)) -d.scope = True:(, AttributeError('cannot set this attribute',)) -d.xxx = True:(, AttributeError('cannot set this attribute',)) +d.scope = True:(, AttributeError('cannot set attribute scope',)) +d.xxx = True:(, AttributeError('cannot set attribute xxx',)) >> _DictionaryItem d.get("a", 2, 3):(, TypeError('function takes at most 2 arguments (3 given)',)) >>> Testing StringToChars using d.get(%s) -d.get(1):(, TypeError('object must be string',)) +d.get(1):(, TypeError('expected bytes() or str() instance, but got int',)) d.get(b"\0"):(, TypeError('expected bytes with no null',)) d.get("\0"):(, TypeError('expected bytes with no null',)) <<< Finished d.pop("a"):(, KeyError('a',)) -dl.pop("a"):(, error('dict is locked',)) +dl.pop("a"):(, error('dictionary is locked',)) >> DictionaryIterNext for i in ned: ned["a"] = 1:(, RuntimeError('hashtab changed during iteration',)) >> DictionaryAssItem -dl["b"] = 1:(, error('dict is locked',)) +dl["b"] = 1:(, error('dictionary is locked',)) >>> Testing StringToChars using d[%s] = 1 -d[1] = 1:(, TypeError('object must be string',)) +d[1] = 1:(, TypeError('expected bytes() or str() instance, but got int',)) d[b"\0"] = 1:(, TypeError('expected bytes with no null',)) d["\0"] = 1:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d["a"] = {%s : 1} -d["a"] = {1 : 1}:(, TypeError('object must be string',)) +d["a"] = {1 : 1}:(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = {b"\0" : 1}:(, TypeError('expected bytes with no null',)) d["a"] = {"\0" : 1}:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}} -d["a"] = {"abc" : {1 : 1}}:(, TypeError('object must be string',)) +d["a"] = {"abc" : {1 : 1}}:(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = {"abc" : {b"\0" : 1}}:(, TypeError('expected bytes with no null',)) d["a"] = {"abc" : {"\0" : 1}}:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})} -d["a"] = {"abc" : Mapping({1 : 1})}:(, TypeError('object must be string',)) +d["a"] = {"abc" : Mapping({1 : 1})}:(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = {"abc" : Mapping({b"\0" : 1})}:(, TypeError('expected bytes with no null',)) d["a"] = {"abc" : Mapping({"\0" : 1})}:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d["a"] = {"abc" : %s} -d["a"] = {"abc" : FailingIter()}:(, TypeError('unable to convert to vim structure',)) +d["a"] = {"abc" : FailingIter()}:(, TypeError('unable to convert FailingIter to vim structure',)) d["a"] = {"abc" : FailingIterNext()}:(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s} -d["a"] = {"abc" : None}:(, TypeError('unable to convert to vim structure',)) +d["a"] = {"abc" : None}:(, TypeError('unable to convert NoneType to vim structure',)) d["a"] = {"abc" : {b"": 1}}:(, ValueError('empty keys are not allowed',)) d["a"] = {"abc" : {"": 1}}:(, ValueError('empty keys are not allowed',)) d["a"] = {"abc" : FailingMapping()}:(, NotImplementedError()) d["a"] = {"abc" : FailingMappingKey()}:(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({%s : 1}) -d["a"] = Mapping({1 : 1}):(, TypeError('object must be string',)) +d["a"] = Mapping({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = Mapping({b"\0" : 1}):(, TypeError('expected bytes with no null',)) d["a"] = Mapping({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}}) -d["a"] = Mapping({"abc" : {1 : 1}}):(, TypeError('object must be string',)) +d["a"] = Mapping({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = Mapping({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) d["a"] = Mapping({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})}) -d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(, TypeError('object must be string',)) +d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = Mapping({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : FailingIter()}):(, TypeError('unable to convert to vim structure',)) +d["a"] = Mapping({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) d["a"] = Mapping({"abc" : FailingIterNext()}):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : None}):(, TypeError('unable to convert to vim structure',)) +d["a"] = Mapping({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) d["a"] = Mapping({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) d["a"] = Mapping({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) d["a"] = Mapping({"abc" : FailingMapping()}):(, NotImplementedError()) d["a"] = Mapping({"abc" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using d["a"] = %s -d["a"] = FailingIter():(, TypeError('unable to convert to vim structure',)) +d["a"] = FailingIter():(, TypeError('unable to convert FailingIter to vim structure',)) d["a"] = FailingIterNext():(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d["a"] = %s -d["a"] = None:(, TypeError('unable to convert to vim structure',)) +d["a"] = None:(, TypeError('unable to convert NoneType to vim structure',)) d["a"] = {b"": 1}:(, ValueError('empty keys are not allowed',)) d["a"] = {"": 1}:(, ValueError('empty keys are not allowed',)) d["a"] = FailingMapping():(, NotImplementedError()) @@ -547,52 +547,52 @@ d.update(FailingIter()):(, NotImplementedError()) d.update(FailingIterNext()):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update({%s : 1}) -d.update({1 : 1}):(, TypeError('object must be string',)) +d.update({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',)) d.update({b"\0" : 1}):(, TypeError('expected bytes with no null',)) d.update({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update({"abc" : {%s : 1}}) -d.update({"abc" : {1 : 1}}):(, TypeError('object must be string',)) +d.update({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) d.update({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) d.update({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})}) -d.update({"abc" : Mapping({1 : 1})}):(, TypeError('object must be string',)) +d.update({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) d.update({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) d.update({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d.update({"abc" : %s}) -d.update({"abc" : FailingIter()}):(, TypeError('unable to convert to vim structure',)) +d.update({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) d.update({"abc" : FailingIterNext()}):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d.update({"abc" : %s}) -d.update({"abc" : None}):(, TypeError('unable to convert to vim structure',)) +d.update({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) d.update({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) d.update({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) d.update({"abc" : FailingMapping()}):(, NotImplementedError()) d.update({"abc" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update(Mapping({%s : 1})) -d.update(Mapping({1 : 1})):(, TypeError('object must be string',)) +d.update(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) d.update(Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) d.update(Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}})) -d.update(Mapping({"abc" : {1 : 1}})):(, TypeError('object must be string',)) +d.update(Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) d.update(Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) d.update(Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})})) -d.update(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('object must be string',)) +d.update(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) d.update(Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) d.update(Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert to vim structure',)) +d.update(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) d.update(Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : None})):(, TypeError('unable to convert to vim structure',)) +d.update(Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) d.update(Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) d.update(Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) d.update(Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) @@ -610,68 +610,68 @@ d.update(FailingMapping()):(, NotImplementedError() d.update(FailingMappingKey()):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update(((%s, 0),)) -d.update(((1, 0),)):(, TypeError('object must be string',)) +d.update(((1, 0),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update(((b"\0", 0),)):(, TypeError('expected bytes with no null',)) d.update((("\0", 0),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update((("a", {%s : 1}),)) -d.update((("a", {1 : 1}),)):(, TypeError('object must be string',)) +d.update((("a", {1 : 1}),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", {b"\0" : 1}),)):(, TypeError('expected bytes with no null',)) d.update((("a", {"\0" : 1}),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),)) -d.update((("a", {"abc" : {1 : 1}}),)):(, TypeError('object must be string',)) +d.update((("a", {"abc" : {1 : 1}}),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", {"abc" : {b"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) d.update((("a", {"abc" : {"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),)) -d.update((("a", {"abc" : Mapping({1 : 1})}),)):(, TypeError('object must be string',)) +d.update((("a", {"abc" : Mapping({1 : 1})}),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", {"abc" : Mapping({b"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : FailingIter()}),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", {"abc" : FailingIter()}),)):(, TypeError('unable to convert FailingIter to vim structure',)) d.update((("a", {"abc" : FailingIterNext()}),)):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : None}),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", {"abc" : None}),)):(, TypeError('unable to convert NoneType to vim structure',)) d.update((("a", {"abc" : {b"": 1}}),)):(, ValueError('empty keys are not allowed',)) d.update((("a", {"abc" : {"": 1}}),)):(, ValueError('empty keys are not allowed',)) d.update((("a", {"abc" : FailingMapping()}),)):(, NotImplementedError()) d.update((("a", {"abc" : FailingMappingKey()}),)):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),)) -d.update((("a", Mapping({1 : 1})),)):(, TypeError('object must be string',)) +d.update((("a", Mapping({1 : 1})),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", Mapping({b"\0" : 1})),)):(, TypeError('expected bytes with no null',)) d.update((("a", Mapping({"\0" : 1})),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),)) -d.update((("a", Mapping({"abc" : {1 : 1}})),)):(, TypeError('object must be string',)) +d.update((("a", Mapping({"abc" : {1 : 1}})),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", Mapping({"abc" : {b"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),)) -d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(, TypeError('object must be string',)) +d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", Mapping({"abc" : Mapping({b"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : FailingIter()})),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", Mapping({"abc" : FailingIter()})),)):(, TypeError('unable to convert FailingIter to vim structure',)) d.update((("a", Mapping({"abc" : FailingIterNext()})),)):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : None})),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", Mapping({"abc" : None})),)):(, TypeError('unable to convert NoneType to vim structure',)) d.update((("a", Mapping({"abc" : {b"": 1}})),)):(, ValueError('empty keys are not allowed',)) d.update((("a", Mapping({"abc" : {"": 1}})),)):(, ValueError('empty keys are not allowed',)) d.update((("a", Mapping({"abc" : FailingMapping()})),)):(, NotImplementedError()) d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using d.update((("a", %s),)) -d.update((("a", FailingIter()),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", FailingIter()),)):(, TypeError('unable to convert FailingIter to vim structure',)) d.update((("a", FailingIterNext()),)):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using d.update((("a", %s),)) -d.update((("a", None),)):(, TypeError('unable to convert to vim structure',)) +d.update((("a", None),)):(, TypeError('unable to convert NoneType to vim structure',)) d.update((("a", {b"": 1}),)):(, ValueError('empty keys are not allowed',)) d.update((("a", {"": 1}),)):(, ValueError('empty keys are not allowed',)) d.update((("a", FailingMapping()),)):(, NotImplementedError()) @@ -690,63 +690,63 @@ vim.List(FailingIter()):(, NotImplementedError()) vim.List(FailingIterNext()):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using vim.List([{%s : 1}]) -vim.List([{1 : 1}]):(, TypeError('object must be string',)) +vim.List([{1 : 1}]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([{b"\0" : 1}]):(, TypeError('expected bytes with no null',)) vim.List([{"\0" : 1}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}]) -vim.List([{"abc" : {1 : 1}}]):(, TypeError('object must be string',)) +vim.List([{"abc" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([{"abc" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) vim.List([{"abc" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}]) -vim.List([{"abc" : Mapping({1 : 1})}]):(, TypeError('object must be string',)) +vim.List([{"abc" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([{"abc" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) vim.List([{"abc" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using vim.List([{"abc" : %s}]) -vim.List([{"abc" : FailingIter()}]):(, TypeError('unable to convert to vim structure',)) +vim.List([{"abc" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) vim.List([{"abc" : FailingIterNext()}]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using vim.List([{"abc" : %s}]) -vim.List([{"abc" : None}]):(, TypeError('unable to convert to vim structure',)) +vim.List([{"abc" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) vim.List([{"abc" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) vim.List([{"abc" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) vim.List([{"abc" : FailingMapping()}]):(, NotImplementedError()) vim.List([{"abc" : FailingMappingKey()}]):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using vim.List([Mapping({%s : 1})]) -vim.List([Mapping({1 : 1})]):(, TypeError('object must be string',)) +vim.List([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([Mapping({b"\0" : 1})]):(, TypeError('expected bytes with no null',)) vim.List([Mapping({"\0" : 1})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})]) -vim.List([Mapping({"abc" : {1 : 1}})]):(, TypeError('object must be string',)) +vim.List([Mapping({"abc" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([Mapping({"abc" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) vim.List([Mapping({"abc" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})]) -vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('object must be string',)) +vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([Mapping({"abc" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert to vim structure',)) +vim.List([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) vim.List([Mapping({"abc" : FailingIterNext()})]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : None})]):(, TypeError('unable to convert to vim structure',)) +vim.List([Mapping({"abc" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) vim.List([Mapping({"abc" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) vim.List([Mapping({"abc" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) vim.List([Mapping({"abc" : FailingMapping()})]):(, NotImplementedError()) vim.List([Mapping({"abc" : FailingMappingKey()})]):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using vim.List([%s]) -vim.List([FailingIter()]):(, TypeError('unable to convert to vim structure',)) +vim.List([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',)) vim.List([FailingIterNext()]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using vim.List([%s]) -vim.List([None]):(, TypeError('unable to convert to vim structure',)) +vim.List([None]):(, TypeError('unable to convert NoneType to vim structure',)) vim.List([{b"": 1}]):(, ValueError('empty keys are not allowed',)) vim.List([{"": 1}]):(, ValueError('empty keys are not allowed',)) vim.List([FailingMapping()]):(, NotImplementedError()) @@ -764,63 +764,63 @@ l[:] = FailingIter():(, NotImplementedError()) l[:] = FailingIterNext()::(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l[:] = [{%s : 1}] -l[:] = [{1 : 1}]:(, TypeError('object must be string',)) +l[:] = [{1 : 1}]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [{b"\0" : 1}]:(, TypeError('expected bytes with no null',)) l[:] = [{"\0" : 1}]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}] -l[:] = [{"abc" : {1 : 1}}]:(, TypeError('object must be string',)) +l[:] = [{"abc" : {1 : 1}}]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [{"abc" : {b"\0" : 1}}]:(, TypeError('expected bytes with no null',)) l[:] = [{"abc" : {"\0" : 1}}]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}] -l[:] = [{"abc" : Mapping({1 : 1})}]:(, TypeError('object must be string',)) +l[:] = [{"abc" : Mapping({1 : 1})}]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [{"abc" : Mapping({b"\0" : 1})}]:(, TypeError('expected bytes with no null',)) l[:] = [{"abc" : Mapping({"\0" : 1})}]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : FailingIter()}]:(, TypeError('unable to convert to vim structure',)) +l[:] = [{"abc" : FailingIter()}]:(, TypeError('unable to convert FailingIter to vim structure',)) l[:] = [{"abc" : FailingIterNext()}]:(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : None}]:(, TypeError('unable to convert to vim structure',)) +l[:] = [{"abc" : None}]:(, TypeError('unable to convert NoneType to vim structure',)) l[:] = [{"abc" : {b"": 1}}]:(, ValueError('empty keys are not allowed',)) l[:] = [{"abc" : {"": 1}}]:(, ValueError('empty keys are not allowed',)) l[:] = [{"abc" : FailingMapping()}]:(, NotImplementedError()) l[:] = [{"abc" : FailingMappingKey()}]:(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({%s : 1})] -l[:] = [Mapping({1 : 1})]:(, TypeError('object must be string',)) +l[:] = [Mapping({1 : 1})]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [Mapping({b"\0" : 1})]:(, TypeError('expected bytes with no null',)) l[:] = [Mapping({"\0" : 1})]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})] -l[:] = [Mapping({"abc" : {1 : 1}})]:(, TypeError('object must be string',)) +l[:] = [Mapping({"abc" : {1 : 1}})]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [Mapping({"abc" : {b"\0" : 1}})]:(, TypeError('expected bytes with no null',)) l[:] = [Mapping({"abc" : {"\0" : 1}})]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})] -l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(, TypeError('object must be string',)) +l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [Mapping({"abc" : Mapping({b"\0" : 1})})]:(, TypeError('expected bytes with no null',)) l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : FailingIter()})]:(, TypeError('unable to convert to vim structure',)) +l[:] = [Mapping({"abc" : FailingIter()})]:(, TypeError('unable to convert FailingIter to vim structure',)) l[:] = [Mapping({"abc" : FailingIterNext()})]:(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : None})]:(, TypeError('unable to convert to vim structure',)) +l[:] = [Mapping({"abc" : None})]:(, TypeError('unable to convert NoneType to vim structure',)) l[:] = [Mapping({"abc" : {b"": 1}})]:(, ValueError('empty keys are not allowed',)) l[:] = [Mapping({"abc" : {"": 1}})]:(, ValueError('empty keys are not allowed',)) l[:] = [Mapping({"abc" : FailingMapping()})]:(, NotImplementedError()) l[:] = [Mapping({"abc" : FailingMappingKey()})]:(, NotImplementedError()) <<< Finished >>> Testing *Iter* using l[:] = [%s] -l[:] = [FailingIter()]:(, TypeError('unable to convert to vim structure',)) +l[:] = [FailingIter()]:(, TypeError('unable to convert FailingIter to vim structure',)) l[:] = [FailingIterNext()]:(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l[:] = [%s] -l[:] = [None]:(, TypeError('unable to convert to vim structure',)) +l[:] = [None]:(, TypeError('unable to convert NoneType to vim structure',)) l[:] = [{b"": 1}]:(, ValueError('empty keys are not allowed',)) l[:] = [{"": 1}]:(, ValueError('empty keys are not allowed',)) l[:] = [FailingMapping()]:(, NotImplementedError()) @@ -832,63 +832,63 @@ l.extend(FailingIter()):(, NotImplementedError()) l.extend(FailingIterNext()):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l.extend([{%s : 1}]) -l.extend([{1 : 1}]):(, TypeError('object must be string',)) +l.extend([{1 : 1}]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([{b"\0" : 1}]):(, TypeError('expected bytes with no null',)) l.extend([{"\0" : 1}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}]) -l.extend([{"abc" : {1 : 1}}]):(, TypeError('object must be string',)) +l.extend([{"abc" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([{"abc" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) l.extend([{"abc" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}]) -l.extend([{"abc" : Mapping({1 : 1})}]):(, TypeError('object must be string',)) +l.extend([{"abc" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([{"abc" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) l.extend([{"abc" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using l.extend([{"abc" : %s}]) -l.extend([{"abc" : FailingIter()}]):(, TypeError('unable to convert to vim structure',)) +l.extend([{"abc" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) l.extend([{"abc" : FailingIterNext()}]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l.extend([{"abc" : %s}]) -l.extend([{"abc" : None}]):(, TypeError('unable to convert to vim structure',)) +l.extend([{"abc" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) l.extend([{"abc" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) l.extend([{"abc" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) l.extend([{"abc" : FailingMapping()}]):(, NotImplementedError()) l.extend([{"abc" : FailingMappingKey()}]):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l.extend([Mapping({%s : 1})]) -l.extend([Mapping({1 : 1})]):(, TypeError('object must be string',)) +l.extend([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([Mapping({b"\0" : 1})]):(, TypeError('expected bytes with no null',)) l.extend([Mapping({"\0" : 1})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})]) -l.extend([Mapping({"abc" : {1 : 1}})]):(, TypeError('object must be string',)) +l.extend([Mapping({"abc" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([Mapping({"abc" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) l.extend([Mapping({"abc" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})]) -l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('object must be string',)) +l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([Mapping({"abc" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert to vim structure',)) +l.extend([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) l.extend([Mapping({"abc" : FailingIterNext()})]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : None})]):(, TypeError('unable to convert to vim structure',)) +l.extend([Mapping({"abc" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) l.extend([Mapping({"abc" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) l.extend([Mapping({"abc" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) l.extend([Mapping({"abc" : FailingMapping()})]):(, NotImplementedError()) l.extend([Mapping({"abc" : FailingMappingKey()})]):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using l.extend([%s]) -l.extend([FailingIter()]):(, TypeError('unable to convert to vim structure',)) +l.extend([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',)) l.extend([FailingIterNext()]):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using l.extend([%s]) -l.extend([None]):(, TypeError('unable to convert to vim structure',)) +l.extend([None]):(, TypeError('unable to convert NoneType to vim structure',)) l.extend([{b"": 1}]):(, ValueError('empty keys are not allowed',)) l.extend([{"": 1}]):(, ValueError('empty keys are not allowed',)) l.extend([FailingMapping()]):(, NotImplementedError()) @@ -897,134 +897,134 @@ l.extend([FailingMappingKey()]):(, NotImplementedEr >> ListSetattr del l.locked:(, AttributeError('cannot delete vim.List attributes',)) l.locked = FailingTrue():(, NotImplementedError()) -l.xxx = True:(, AttributeError('cannot set this attribute',)) +l.xxx = True:(, AttributeError('cannot set attribute xxx',)) > Function >> FunctionConstructor -vim.Function("123"):(, ValueError('unnamed function does not exist',)) -vim.Function("xxx_non_existent_function_xxx"):(, ValueError('function does not exist',)) +vim.Function("123"):(, ValueError('unnamed function 123 does not exist',)) +vim.Function("xxx_non_existent_function_xxx"):(, ValueError('function xxx_non_existent_function_xxx does not exist',)) vim.Function("xxx#non#existent#function#xxx"):NOT FAILED >> FunctionCall >>> Testing StringToChars using f({%s : 1}) -f({1 : 1}):(, TypeError('object must be string',)) +f({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',)) f({b"\0" : 1}):(, TypeError('expected bytes with no null',)) f({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using f({"abc" : {%s : 1}}) -f({"abc" : {1 : 1}}):(, TypeError('object must be string',)) +f({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) f({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) f({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using f({"abc" : Mapping({%s : 1})}) -f({"abc" : Mapping({1 : 1})}):(, TypeError('object must be string',)) +f({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) f({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) f({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using f({"abc" : %s}) -f({"abc" : FailingIter()}):(, TypeError('unable to convert to vim structure',)) +f({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) f({"abc" : FailingIterNext()}):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using f({"abc" : %s}) -f({"abc" : None}):(, TypeError('unable to convert to vim structure',)) +f({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) f({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) f({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) f({"abc" : FailingMapping()}):(, NotImplementedError()) f({"abc" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using f(Mapping({%s : 1})) -f(Mapping({1 : 1})):(, TypeError('object must be string',)) +f(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) f(Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) f(Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}})) -f(Mapping({"abc" : {1 : 1}})):(, TypeError('object must be string',)) +f(Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) f(Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) f(Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})})) -f(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('object must be string',)) +f(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) f(Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) f(Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert to vim structure',)) +f(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) f(Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : None})):(, TypeError('unable to convert to vim structure',)) +f(Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) f(Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) f(Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) f(Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) f(Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using f(%s) -f(FailingIter()):(, TypeError('unable to convert to vim structure',)) +f(FailingIter()):(, TypeError('unable to convert FailingIter to vim structure',)) f(FailingIterNext()):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using f(%s) -f(None):(, TypeError('unable to convert to vim structure',)) +f(None):(, TypeError('unable to convert NoneType to vim structure',)) f({b"": 1}):(, ValueError('empty keys are not allowed',)) f({"": 1}):(, ValueError('empty keys are not allowed',)) f(FailingMapping()):(, NotImplementedError()) f(FailingMappingKey()):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using fd(self={%s : 1}) -fd(self={1 : 1}):(, TypeError('object must be string',)) +fd(self={1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self={b"\0" : 1}):(, TypeError('expected bytes with no null',)) fd(self={"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using fd(self={"abc" : {%s : 1}}) -fd(self={"abc" : {1 : 1}}):(, TypeError('object must be string',)) +fd(self={"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self={"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) fd(self={"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})}) -fd(self={"abc" : Mapping({1 : 1})}):(, TypeError('object must be string',)) +fd(self={"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self={"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) fd(self={"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using fd(self={"abc" : %s}) -fd(self={"abc" : FailingIter()}):(, TypeError('unable to convert to vim structure',)) +fd(self={"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) fd(self={"abc" : FailingIterNext()}):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using fd(self={"abc" : %s}) -fd(self={"abc" : None}):(, TypeError('unable to convert to vim structure',)) +fd(self={"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) fd(self={"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) fd(self={"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) fd(self={"abc" : FailingMapping()}):(, NotImplementedError()) fd(self={"abc" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using fd(self=Mapping({%s : 1})) -fd(self=Mapping({1 : 1})):(, TypeError('object must be string',)) +fd(self=Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self=Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) fd(self=Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}})) -fd(self=Mapping({"abc" : {1 : 1}})):(, TypeError('object must be string',)) +fd(self=Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self=Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) fd(self=Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})})) -fd(self=Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('object must be string',)) +fd(self=Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self=Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished >>> Testing *Iter* using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert to vim structure',)) +fd(self=Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) fd(self=Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) <<< Finished >>> Testing ConvertFromPyObject using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : None})):(, TypeError('unable to convert to vim structure',)) +fd(self=Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) fd(self=Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) fd(self=Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) fd(self=Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) fd(self=Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using fd(self=%s) -fd(self=FailingIter()):(, TypeError('unable to convert object to vim dictionary',)) -fd(self=FailingIterNext()):(, TypeError('unable to convert object to vim dictionary',)) +fd(self=FailingIter()):(, TypeError('unable to convert FailingIter to vim dictionary',)) +fd(self=FailingIterNext()):(, TypeError('unable to convert FailingIterNext to vim dictionary',)) <<< Finished >>> Testing ConvertFromPyObject using fd(self=%s) -fd(self=None):(, TypeError('unable to convert object to vim dictionary',)) +fd(self=None):(, TypeError('unable to convert NoneType to vim dictionary',)) fd(self={b"": 1}):(, ValueError('empty keys are not allowed',)) fd(self={"": 1}):(, ValueError('empty keys are not allowed',)) fd(self=FailingMapping()):(, NotImplementedError()) @@ -1043,7 +1043,7 @@ vim.tabpages[1000]:(, IndexError('no such tab page',)) >> WindowAttr vim.current.window.xxx:(, AttributeError("'vim.window' object has no attribute 'xxx'",)) >> WindowSetattr -vim.current.window.buffer = 0:(, TypeError('readonly attribute',)) +vim.current.window.buffer = 0:(, TypeError('readonly attribute: buffer',)) vim.current.window.cursor = (100000000, 100000000):(, error('cursor position outside buffer',)) vim.current.window.cursor = True:(, TypeError('argument must be 2-item sequence, not bool',)) vim.current.window.height = "abc":(, TypeError('an integer is required',)) @@ -1071,10 +1071,10 @@ vim.current.buffer[100000000] = "":(, IndexError('line numbe >> BufferAttr vim.current.buffer.xxx:(, AttributeError("'vim.buffer' object has no attribute 'xxx'",)) >> BufferSetattr -vim.current.buffer.name = True:(, TypeError('object must be string',)) +vim.current.buffer.name = True:(, TypeError('expected bytes() or str() instance, but got bool',)) vim.current.buffer.xxx = True:(, AttributeError('xxx',)) >> BufferMark -vim.current.buffer.mark(0):(, TypeError('object must be string',)) +vim.current.buffer.mark(0):(, TypeError('expected bytes() or str() instance, but got int',)) vim.current.buffer.mark("abc"):(, ValueError('mark name must be a single character',)) vim.current.buffer.mark("!"):(, error('invalid mark name',)) >> BufferRange @@ -1088,9 +1088,9 @@ vim.buffers[100000000]:(, KeyError(100000000,)) vim.current.xxx:(, AttributeError("'vim.currentdata' object has no attribute 'xxx'",)) >> CurrentSetattr vim.current.line = True:(, TypeError('bad argument type for built-in operation',)) -vim.current.buffer = True:(, TypeError('expected vim.Buffer object',)) -vim.current.window = True:(, TypeError('expected vim.Window object',)) -vim.current.tabpage = True:(, TypeError('expected vim.TabPage object',)) +vim.current.buffer = True:(, TypeError('expected vim.Buffer object, but got bool',)) +vim.current.window = True:(, TypeError('expected vim.Window object, but got bool',)) +vim.current.tabpage = True:(, TypeError('expected vim.TabPage object, but got bool',)) vim.current.xxx = True:(, AttributeError('xxx',)) 3,xx before diff --git a/src/version.c b/src/version.c index bf9b2b318c..2004a94fa9 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1230, /**/ 1229, /**/ From 8d5c9bef5860ea7187d90cd153cdc6c575fc042c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 13:46:40 +0200 Subject: [PATCH 14/20] Added tag v7-3-1230 for changeset f5c822e5a0eb --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f59e6bf3da..8e08d0e89c 100644 --- a/.hgtags +++ b/.hgtags @@ -2566,3 +2566,4 @@ b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 5cee875f30961cf1adadf386b7e2764ea8aeeb64 v7-3-1227 620d9b59d4ed9deaac614c707c71257907b1dd21 v7-3-1228 b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 +f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 From ce9a6dc7aed758fb7a7820015356dbbea7881f4e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:16:57 +0200 Subject: [PATCH 15/20] updated for version 7.3.1231 Problem: Python: use of numbers not consistent. Solution: Add support for Number protocol. (ZyX) --- src/if_py_both.h | 154 ++++++++++++++++++++++++++++++++---------- src/if_python.c | 13 ++++ src/if_python3.c | 13 ++++ src/testdir/test86.ok | 8 +-- src/testdir/test87.ok | 8 +-- src/version.c | 2 + 6 files changed, 154 insertions(+), 44 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index e11c62e866..93470fac06 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -151,6 +151,95 @@ StringToChars(PyObject *object, PyObject **todecref) return (char_u *) p; } +#define NUMBER_LONG 1 +#define NUMBER_INT 2 +#define NUMBER_NATURAL 4 +#define NUMBER_UNSIGNED 8 + + static int +NumberToLong(PyObject *obj, long *result, int flags) +{ +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(obj)) + { + *result = PyInt_AsLong(obj); + if (PyErr_Occurred()) + return -1; + } + else +#endif + if (PyLong_Check(obj)) + { + *result = PyLong_AsLong(obj); + if (PyErr_Occurred()) + return -1; + } + else if (PyNumber_Check(obj)) + { + PyObject *num; + + if (!(num = PyNumber_Long(obj))) + return -1; + + *result = PyLong_AsLong(num); + + Py_DECREF(num); + + if (PyErr_Occurred()) + return -1; + } + else + { + PyErr_FORMAT(PyExc_TypeError, +#if PY_MAJOR_VERSION < 3 + "expected int(), long() or something supporting " + "coercing to long(), but got %s" +#else + "expected int() or something supporting coercing to int(), " + "but got %s" +#endif + , Py_TYPE_NAME(obj)); + return -1; + } + + if (flags & NUMBER_INT) + { + if (*result > INT_MAX) + { + PyErr_SET_STRING(PyExc_OverflowError, + "value is too large to fit into C int type"); + return -1; + } + else if (*result < INT_MIN) + { + PyErr_SET_STRING(PyExc_OverflowError, + "value is too small to fit into C int type"); + return -1; + } + } + + if (flags & NUMBER_NATURAL) + { + if (*result <= 0) + { + PyErr_SET_STRING(PyExc_ValueError, + "number must be greater then zero"); + return -1; + } + } + else if (flags & NUMBER_UNSIGNED) + { + if (*result < 0) + { + PyErr_SET_STRING(PyExc_ValueError, + "number must be greater or equal to zero"); + return -1; + } + } + + return 0; +} + static int add_string(PyObject *list, char *s) { @@ -243,13 +332,8 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) if (strcmp(name, "softspace") == 0) { - if (!PyInt_Check(val)) - { - PyErr_SET_STRING(PyExc_TypeError, "softspace must be an integer"); + if (NumberToLong(val, &(self->softspace), NUMBER_UNSIGNED)) return -1; - } - - self->softspace = PyInt_AsLong(val); return 0; } @@ -2839,23 +2923,15 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) } else if (flags & SOPT_NUM) { - int val; + long val; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(valObject)) - val = PyInt_AsLong(valObject); - else -#endif - if (PyLong_Check(valObject)) - val = PyLong_AsLong(valObject); - else + if (NumberToLong(valObject, &val, NUMBER_INT)) { - PyErr_SET_STRING(PyExc_TypeError, "object must be integer"); Py_XDECREF(todecref); return -1; } - r = set_option_value_for(key, val, NULL, opt_flags, + r = set_option_value_for(key, (int) val, NULL, opt_flags, self->opt_type, self->from); } else @@ -3265,10 +3341,10 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) } else if (strcmp(name, "height") == 0) { - int height; + long height; win_T *savewin; - if (!PyArg_Parse(val, "i", &height)) + if (NumberToLong(val, &height, NUMBER_INT)) return -1; #ifdef FEAT_GUI @@ -3278,7 +3354,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) curwin = self->win; VimTryStart(); - win_setheight(height); + win_setheight((int) height); curwin = savewin; if (VimTryEnd()) return -1; @@ -3288,10 +3364,10 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) #ifdef FEAT_VERTSPLIT else if (strcmp(name, "width") == 0) { - int width; + long width; win_T *savewin; - if (!PyArg_Parse(val, "i", &width)) + if (NumberToLong(val, &width, NUMBER_INT)) return -1; #ifdef FEAT_GUI @@ -3301,7 +3377,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) curwin = self->win; VimTryStart(); - win_setwidth(width); + win_setwidth((int) width); curwin = savewin; if (VimTryEnd()) return -1; @@ -4555,22 +4631,12 @@ BufMapLength(PyObject *self UNUSED) BufMapItem(PyObject *self UNUSED, PyObject *keyObject) { buf_T *b; - int bnr; + long bnr; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(keyObject)) - bnr = PyInt_AsLong(keyObject); - else -#endif - if (PyLong_Check(keyObject)) - bnr = PyLong_AsLong(keyObject); - else - { - PyErr_SET_STRING(PyExc_TypeError, "key must be integer"); + if (NumberToLong(keyObject, &bnr, NUMBER_INT|NUMBER_NATURAL)) return NULL; - } - b = buflist_findnr(bnr); + b = buflist_findnr((int) bnr); if (b) return BufferNew(b); @@ -5345,12 +5411,16 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) { tv->v_type = VAR_NUMBER; tv->vval.v_number = (varnumber_T) PyInt_AsLong(obj); + if (PyErr_Occurred()) + return -1; } #endif else if (PyLong_Check(obj)) { tv->v_type = VAR_NUMBER; tv->vval.v_number = (varnumber_T) PyLong_AsLong(obj); + if (PyErr_Occurred()) + return -1; } else if (PyDict_Check(obj)) return convert_dl(obj, tv, pydict_to_tv, lookup_dict); @@ -5367,6 +5437,18 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) return convert_dl(obj, tv, pyseq_to_tv, lookup_dict); else if (PyMapping_Check(obj)) return convert_dl(obj, tv, pymap_to_tv, lookup_dict); + else if (PyNumber_Check(obj)) + { + PyObject *num; + + if (!(num = PyNumber_Long(obj))) + return -1; + + tv->v_type = VAR_NUMBER; + tv->vval.v_number = (varnumber_T) PyLong_AsLong(num); + + Py_DECREF(num); + } else { PyErr_FORMAT(PyExc_TypeError, diff --git a/src/if_python.c b/src/if_python.c index 28cd36f853..da2783889f 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -220,6 +220,7 @@ struct PyMethodDef { Py_ssize_t a; }; # define PyObject_CallFunctionObjArgs dll_PyObject_CallFunctionObjArgs # define PyObject_CallFunction dll_PyObject_CallFunction # define PyObject_Call dll_PyObject_Call +# define PyObject_Repr dll_PyObject_Repr # define PyString_AsString dll_PyString_AsString # define PyString_AsStringAndSize dll_PyString_AsStringAndSize # define PyString_FromString dll_PyString_FromString @@ -233,6 +234,8 @@ struct PyMethodDef { Py_ssize_t a; }; # define PyFloat_AsDouble dll_PyFloat_AsDouble # define PyFloat_FromDouble dll_PyFloat_FromDouble # define PyFloat_Type (*dll_PyFloat_Type) +# define PyNumber_Check dll_PyNumber_Check +# define PyNumber_Long dll_PyNumber_Long # define PyImport_AddModule (*dll_PyImport_AddModule) # define PySys_SetObject dll_PySys_SetObject # define PySys_GetObject dll_PySys_GetObject @@ -360,6 +363,7 @@ static PyObject* (*dll_PyObject_SetAttrString)(PyObject *, const char *, PyObjec static PyObject* (*dll_PyObject_CallFunctionObjArgs)(PyObject *, ...); static PyObject* (*dll_PyObject_CallFunction)(PyObject *, char *, ...); static PyObject* (*dll_PyObject_Call)(PyObject *, PyObject *, PyObject *); +static PyObject* (*dll_PyObject_Repr)(PyObject *); static char*(*dll_PyString_AsString)(PyObject *); static int(*dll_PyString_AsStringAndSize)(PyObject *, char **, int *); static PyObject*(*dll_PyString_FromString)(const char *); @@ -372,6 +376,8 @@ static PyObject *(*py_PyUnicode_AsEncodedString)(PyObject *, char *, char *); static double(*dll_PyFloat_AsDouble)(PyObject *); static PyObject*(*dll_PyFloat_FromDouble)(double); static PyTypeObject* dll_PyFloat_Type; +static int(*dll_PyNumber_Check)(PyObject *); +static PyObject*(*dll_PyNumber_Long)(PyObject *); static int(*dll_PySys_SetObject)(char *, PyObject *); static PyObject *(*dll_PySys_GetObject)(char *); static int(*dll_PySys_SetArgv)(int, char **); @@ -440,6 +446,7 @@ static PyObject *imp_PyExc_TypeError; static PyObject *imp_PyExc_ValueError; static PyObject *imp_PyExc_RuntimeError; static PyObject *imp_PyExc_ImportError; +static PyObject *imp_PyExc_OverflowError; # define PyExc_AttributeError imp_PyExc_AttributeError # define PyExc_IndexError imp_PyExc_IndexError @@ -449,6 +456,7 @@ static PyObject *imp_PyExc_ImportError; # define PyExc_ValueError imp_PyExc_ValueError # define PyExc_RuntimeError imp_PyExc_RuntimeError # define PyExc_ImportError imp_PyExc_ImportError +# define PyExc_OverflowError imp_PyExc_OverflowError /* * Table of name to function pointer of python. @@ -533,6 +541,7 @@ static struct {"PyObject_CallFunctionObjArgs", (PYTHON_PROC*)&dll_PyObject_CallFunctionObjArgs}, {"PyObject_CallFunction", (PYTHON_PROC*)&dll_PyObject_CallFunction}, {"PyObject_Call", (PYTHON_PROC*)&dll_PyObject_Call}, + {"PyObject_Repr", (PYTHON_PROC*)&dll_PyObject_Repr}, {"PyString_AsString", (PYTHON_PROC*)&dll_PyString_AsString}, {"PyString_AsStringAndSize", (PYTHON_PROC*)&dll_PyString_AsStringAndSize}, {"PyString_FromString", (PYTHON_PROC*)&dll_PyString_FromString}, @@ -545,6 +554,8 @@ static struct {"PyFloat_AsDouble", (PYTHON_PROC*)&dll_PyFloat_AsDouble}, {"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble}, {"PyImport_AddModule", (PYTHON_PROC*)&dll_PyImport_AddModule}, + {"PyNumber_Check", (PYTHON_PROC*)&dll_PyNumber_Check}, + {"PyNumber_Long", (PYTHON_PROC*)&dll_PyNumber_Long}, {"PySys_SetObject", (PYTHON_PROC*)&dll_PySys_SetObject}, {"PySys_GetObject", (PYTHON_PROC*)&dll_PySys_GetObject}, {"PySys_SetArgv", (PYTHON_PROC*)&dll_PySys_SetArgv}, @@ -722,6 +733,7 @@ get_exceptions(void) imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError"); imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError"); + imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError"); Py_XINCREF(imp_PyExc_AttributeError); Py_XINCREF(imp_PyExc_IndexError); Py_XINCREF(imp_PyExc_KeyError); @@ -730,6 +742,7 @@ get_exceptions(void) Py_XINCREF(imp_PyExc_ValueError); Py_XINCREF(imp_PyExc_RuntimeError); Py_XINCREF(imp_PyExc_ImportError); + Py_XINCREF(imp_PyExc_OverflowError); Py_XDECREF(exmod); } #endif /* DYNAMIC_PYTHON */ diff --git a/src/if_python3.c b/src/if_python3.c index 9bb2a4f7f5..3d9a5ee4c9 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -160,6 +160,7 @@ # define PyMapping_Keys py3_PyMapping_Keys # define PyIter_Next py3_PyIter_Next # define PyObject_GetIter py3_PyObject_GetIter +# define PyObject_Repr py3_PyObject_Repr # define PyObject_GetItem py3_PyObject_GetItem # define PyObject_IsTrue py3_PyObject_IsTrue # define PyModule_GetDict py3_PyModule_GetDict @@ -211,6 +212,8 @@ # define PyType_Type (*py3_PyType_Type) # define PySlice_Type (*py3_PySlice_Type) # define PyFloat_Type (*py3_PyFloat_Type) +# define PyNumber_Check (*py3_PyNumber_Check) +# define PyNumber_Long (*py3_PyNumber_Long) # define PyBool_Type (*py3_PyBool_Type) # define PyErr_NewException py3_PyErr_NewException # ifdef Py_DEBUG @@ -310,6 +313,7 @@ static PyObject* (*py3_PyLong_FromLong)(long); static PyObject* (*py3_PyDict_New)(void); static PyObject* (*py3_PyIter_Next)(PyObject *); static PyObject* (*py3_PyObject_GetIter)(PyObject *); +static PyObject* (*py3_PyObject_Repr)(PyObject *); static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *); static int (*py3_PyObject_IsTrue)(PyObject *); static PyObject* (*py3_Py_BuildValue)(char *, ...); @@ -365,6 +369,8 @@ static PyTypeObject* py3_PyType_Type; static PyTypeObject* py3_PySlice_Type; static PyTypeObject* py3_PyFloat_Type; static PyTypeObject* py3_PyBool_Type; +static int (*py3_PyNumber_Check)(PyObject *); +static PyObject* (*py3_PyNumber_Long)(PyObject *); static PyObject* (*py3_PyErr_NewException)(char *name, PyObject *base, PyObject *dict); static PyObject* (*py3_PyCapsule_New)(void *, char *, PyCapsule_Destructor); static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *); @@ -399,6 +405,7 @@ static PyObject *p3imp_PyExc_TypeError; static PyObject *p3imp_PyExc_ValueError; static PyObject *p3imp_PyExc_RuntimeError; static PyObject *p3imp_PyExc_ImportError; +static PyObject *p3imp_PyExc_OverflowError; # define PyExc_AttributeError p3imp_PyExc_AttributeError # define PyExc_IndexError p3imp_PyExc_IndexError @@ -408,6 +415,7 @@ static PyObject *p3imp_PyExc_ImportError; # define PyExc_ValueError p3imp_PyExc_ValueError # define PyExc_RuntimeError p3imp_PyExc_RuntimeError # define PyExc_ImportError p3imp_PyExc_ImportError +# define PyExc_OverflowError p3imp_PyExc_OverflowError /* * Table of name to function pointer of python. @@ -469,6 +477,7 @@ static struct {"PyMapping_Keys", (PYTHON_PROC*)&py3_PyMapping_Keys}, {"PyIter_Next", (PYTHON_PROC*)&py3_PyIter_Next}, {"PyObject_GetIter", (PYTHON_PROC*)&py3_PyObject_GetIter}, + {"PyObject_Repr", (PYTHON_PROC*)&py3_PyObject_Repr}, {"PyObject_GetItem", (PYTHON_PROC*)&py3_PyObject_GetItem}, {"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue}, {"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong}, @@ -518,6 +527,8 @@ static struct {"PySlice_Type", (PYTHON_PROC*)&py3_PySlice_Type}, {"PyFloat_Type", (PYTHON_PROC*)&py3_PyFloat_Type}, {"PyBool_Type", (PYTHON_PROC*)&py3_PyBool_Type}, + {"PyNumber_Check", (PYTHON_PROC*)&py3_PyNumber_Check}, + {"PyNumber_Long", (PYTHON_PROC*)&py3_PyNumber_Long}, {"PyErr_NewException", (PYTHON_PROC*)&py3_PyErr_NewException}, # ifdef Py_DEBUG {"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount}, @@ -672,6 +683,7 @@ get_py3_exceptions() p3imp_PyExc_ValueError = PyDict_GetItemString(exdict, "ValueError"); p3imp_PyExc_RuntimeError = PyDict_GetItemString(exdict, "RuntimeError"); p3imp_PyExc_ImportError = PyDict_GetItemString(exdict, "ImportError"); + p3imp_PyExc_OverflowError = PyDict_GetItemString(exdict, "OverflowError"); Py_XINCREF(p3imp_PyExc_AttributeError); Py_XINCREF(p3imp_PyExc_IndexError); Py_XINCREF(p3imp_PyExc_KeyError); @@ -680,6 +692,7 @@ get_py3_exceptions() Py_XINCREF(p3imp_PyExc_ValueError); Py_XINCREF(p3imp_PyExc_RuntimeError); Py_XINCREF(p3imp_PyExc_ImportError); + Py_XINCREF(p3imp_PyExc_OverflowError); Py_XDECREF(exmod); } #endif /* DYNAMIC_PYTHON3 */ diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index d94e0eaf77..ab6017be5f 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -438,7 +438,7 @@ test86.in > Output >> OutputSetattr del sys.stdout.softspace:AttributeError:("can't delete OutputObject attributes",) -sys.stdout.softspace = []:TypeError:('softspace must be an integer',) +sys.stdout.softspace = []:TypeError:('expected int(), long() or something supporting coercing to long(), but got list',) sys.stdout.attr = None:AttributeError:('invalid attribute: attr',) >> OutputWrite sys.stdout.write(None):TypeError:('coercing to Unicode: need string or buffer, NoneType found',) @@ -1037,8 +1037,8 @@ vim.current.window.xxx:AttributeError:('xxx',) vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',) vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',) vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',) -vim.current.window.height = "abc":TypeError:('an integer is required',) -vim.current.window.width = "abc":TypeError:('an integer is required',) +vim.current.window.height = "abc":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) +vim.current.window.width = "abc":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) vim.current.window.xxxxxx = True:AttributeError:('xxxxxx',) > WinList >> WinListItem @@ -1072,7 +1072,7 @@ vim.current.buffer.mark("!"):error:('invalid mark name',) vim.current.buffer.range(1, 2, 3):TypeError:('function takes exactly 2 arguments (3 given)',) > BufMap >> BufMapItem -vim.buffers[None]:TypeError:('key must be integer',) +vim.buffers[None]:TypeError:('expected int(), long() or something supporting coercing to long(), but got NoneType',) vim.buffers[100000000]:KeyError:(100000000,) > Current >> CurrentGetattr diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index 4b730349bc..b975eccb44 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -427,7 +427,7 @@ test87.in > Output >> OutputSetattr del sys.stdout.softspace:(, AttributeError("can't delete OutputObject attributes",)) -sys.stdout.softspace = []:(, TypeError('softspace must be an integer',)) +sys.stdout.softspace = []:(, TypeError('expected int() or something supporting coercing to int(), but got list',)) sys.stdout.attr = None:(, AttributeError('invalid attribute: attr',)) >> OutputWrite sys.stdout.write(None):(, TypeError("Can't convert 'NoneType' object to str implicitly",)) @@ -1046,8 +1046,8 @@ vim.current.window.xxx:(, AttributeError("'vim.window' o vim.current.window.buffer = 0:(, TypeError('readonly attribute: buffer',)) vim.current.window.cursor = (100000000, 100000000):(, error('cursor position outside buffer',)) vim.current.window.cursor = True:(, TypeError('argument must be 2-item sequence, not bool',)) -vim.current.window.height = "abc":(, TypeError('an integer is required',)) -vim.current.window.width = "abc":(, TypeError('an integer is required',)) +vim.current.window.height = "abc":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) +vim.current.window.width = "abc":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) vim.current.window.xxxxxx = True:(, AttributeError('xxxxxx',)) > WinList >> WinListItem @@ -1081,7 +1081,7 @@ vim.current.buffer.mark("!"):(, error('invalid mark name',)) vim.current.buffer.range(1, 2, 3):(, TypeError('function takes exactly 2 arguments (3 given)',)) > BufMap >> BufMapItem -vim.buffers[None]:(, TypeError('key must be integer',)) +vim.buffers[None]:(, TypeError('expected int() or something supporting coercing to int(), but got NoneType',)) vim.buffers[100000000]:(, KeyError(100000000,)) > Current >> CurrentGetattr diff --git a/src/version.c b/src/version.c index 2004a94fa9..a775eae31e 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1231, /**/ 1230, /**/ From 0f6ddbd5b19abc3498e425780029c85a82cc87cc Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:16:57 +0200 Subject: [PATCH 16/20] Added tag v7-3-1231 for changeset 537bbfff0c5c --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 8e08d0e89c..b51cad73fd 100644 --- a/.hgtags +++ b/.hgtags @@ -2567,3 +2567,4 @@ b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 620d9b59d4ed9deaac614c707c71257907b1dd21 v7-3-1228 b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 +537bbfff0c5c0bc2307a85133f59f07b00c55e41 v7-3-1231 From af7e16f1b319aca8497e821a59f31d80e8d300fe Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:30:47 +0200 Subject: [PATCH 17/20] updated for version 7.3.1232 Problem: Python: inconsistencies in variable names. Solution: Rename variables. (ZyX) --- src/eval.c | 2 +- src/if_py_both.h | 503 +++++++++++++++++++++++++---------------------- src/version.c | 2 + 3 files changed, 266 insertions(+), 241 deletions(-) diff --git a/src/eval.c b/src/eval.c index 9a0258906f..c37075ba11 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3228,7 +3228,7 @@ next_for_item(fi_void, arg) void *fi_void; char_u *arg; { - forinfo_T *fi = (forinfo_T *)fi_void; + forinfo_T *fi = (forinfo_T *)fi_void; int result; listitem_T *item; diff --git a/src/if_py_both.h b/src/if_py_both.h index 93470fac06..5319466e57 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -107,28 +107,28 @@ Python_Release_Vim(void) * Use Py_XDECREF to decrement reference count. */ static char_u * -StringToChars(PyObject *object, PyObject **todecref) +StringToChars(PyObject *obj, PyObject **todecref) { - char_u *p; + char_u *str; - if (PyBytes_Check(object)) + if (PyBytes_Check(obj)) { - if (PyBytes_AsStringAndSize(object, (char **) &p, NULL) == -1 - || p == NULL) + if (PyBytes_AsStringAndSize(obj, (char **) &str, NULL) == -1 + || str == NULL) return NULL; *todecref = NULL; } - else if (PyUnicode_Check(object)) + else if (PyUnicode_Check(obj)) { PyObject *bytes; - if (!(bytes = PyUnicode_AsEncodedString(object, ENC_OPT, NULL))) + if (!(bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL))) return NULL; - if(PyBytes_AsStringAndSize(bytes, (char **) &p, NULL) == -1 - || p == NULL) + if(PyBytes_AsStringAndSize(bytes, (char **) &str, NULL) == -1 + || str == NULL) { Py_DECREF(bytes); return NULL; @@ -144,11 +144,11 @@ StringToChars(PyObject *object, PyObject **todecref) #else "expected bytes() or str() instance, but got %s" #endif - , Py_TYPE_NAME(object)); + , Py_TYPE_NAME(obj)); return NULL; } - return (char_u *) p; + return (char_u *) str; } #define NUMBER_LONG 1 @@ -263,35 +263,35 @@ ObjectDir(PyObject *self, char **attributes) { PyMethodDef *method; char **attr; - PyObject *r; + PyObject *ret; - if (!(r = PyList_New(0))) + if (!(ret = PyList_New(0))) return NULL; if (self) for (method = self->ob_type->tp_methods ; method->ml_name != NULL ; ++method) - if (add_string(r, (char *) method->ml_name)) + if (add_string(ret, (char *) method->ml_name)) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } for (attr = attributes ; *attr ; ++attr) - if (add_string(r, *attr)) + if (add_string(ret, *attr)) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } #if PY_MAJOR_VERSION < 3 - if (add_string(r, "__members__")) + if (add_string(ret, "__members__")) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } #endif - return r; + return ret; } /* Output buffer management @@ -321,9 +321,9 @@ OutputDir(PyObject *self) } static int -OutputSetattr(OutputObject *self, char *name, PyObject *val) +OutputSetattr(OutputObject *self, char *name, PyObject *valObject) { - if (val == NULL) + if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, "can't delete OutputObject attributes"); @@ -332,7 +332,7 @@ OutputSetattr(OutputObject *self, char *name, PyObject *val) if (strcmp(name, "softspace") == 0) { - if (NumberToLong(val, &(self->softspace), NUMBER_UNSIGNED)) + if (NumberToLong(valObject, &(self->softspace), NUMBER_UNSIGNED)) return -1; return 0; } @@ -518,10 +518,10 @@ LoaderDestructor(LoaderObject *self) static PyObject * LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED) { - PyObject *r = self->module; + PyObject *ret = self->module; - Py_INCREF(r); - return r; + Py_INCREF(ret); + return ret; } static struct PyMethodDef LoaderMethods[] = { @@ -579,7 +579,7 @@ VimCheckInterrupt(void) VimCommand(PyObject *self UNUSED, PyObject *string) { char_u *cmd; - PyObject *result; + PyObject *ret; PyObject *todecref; if (!(cmd = StringToChars(string, &todecref))) @@ -596,13 +596,13 @@ VimCommand(PyObject *self UNUSED, PyObject *string) Py_END_ALLOW_THREADS if (VimTryEnd()) - result = NULL; + ret = NULL; else - result = Py_None; + ret = Py_None; - Py_XINCREF(result); + Py_XINCREF(ret); Py_XDECREF(todecref); - return result; + return ret; } /* @@ -615,7 +615,7 @@ VimCommand(PyObject *self UNUSED, PyObject *string) static PyObject * VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) { - PyObject *result; + PyObject *ret; PyObject *newObj; char ptrBuf[sizeof(void *) * 2 + 3]; @@ -623,8 +623,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) if (depth > 100) { Py_INCREF(Py_None); - result = Py_None; - return result; + ret = Py_None; + return ret; } /* Check if we run into a recursive loop. The item must be in lookup_dict @@ -636,15 +636,15 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) our_tv->v_type == VAR_LIST ? (void *)our_tv->vval.v_list : (void *)our_tv->vval.v_dict); - if ((result = PyDict_GetItemString(lookup_dict, ptrBuf))) + if ((ret = PyDict_GetItemString(lookup_dict, ptrBuf))) { - Py_INCREF(result); - return result; + Py_INCREF(ret); + return ret; } } if (our_tv->v_type == VAR_STRING) - result = PyString_FromString(our_tv->vval.v_string == NULL + ret = PyString_FromString(our_tv->vval.v_string == NULL ? "" : (char *)our_tv->vval.v_string); else if (our_tv->v_type == VAR_NUMBER) { @@ -652,7 +652,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) /* For backwards compatibility numbers are stored as strings. */ sprintf(buf, "%ld", (long)our_tv->vval.v_number); - result = PyString_FromString((char *) buf); + ret = PyString_FromString((char *) buf); } # ifdef FEAT_FLOAT else if (our_tv->v_type == VAR_FLOAT) @@ -660,7 +660,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) char buf[NUMBUFLEN]; sprintf(buf, "%f", our_tv->vval.v_float); - result = PyString_FromString((char *) buf); + ret = PyString_FromString((char *) buf); } # endif else if (our_tv->v_type == VAR_LIST) @@ -671,12 +671,12 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) if (list == NULL) return NULL; - if (!(result = PyList_New(0))) + if (!(ret = PyList_New(0))) return NULL; - if (PyDict_SetItemString(lookup_dict, ptrBuf, result)) + if (PyDict_SetItemString(lookup_dict, ptrBuf, ret)) { - Py_DECREF(result); + Py_DECREF(ret); return NULL; } @@ -684,13 +684,13 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) { if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookup_dict))) { - Py_DECREF(result); + Py_DECREF(ret); return NULL; } - if (PyList_Append(result, newObj)) + if (PyList_Append(ret, newObj)) { Py_DECREF(newObj); - Py_DECREF(result); + Py_DECREF(ret); return NULL; } Py_DECREF(newObj); @@ -706,12 +706,12 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) if (our_tv->vval.v_dict == NULL) return NULL; - if (!(result = PyDict_New())) + if (!(ret = PyDict_New())) return NULL; - if (PyDict_SetItemString(lookup_dict, ptrBuf, result)) + if (PyDict_SetItemString(lookup_dict, ptrBuf, ret)) { - Py_DECREF(result); + Py_DECREF(ret); return NULL; } @@ -724,12 +724,12 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) di = dict_lookup(hi); if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookup_dict))) { - Py_DECREF(result); + Py_DECREF(ret); return NULL; } - if (PyDict_SetItemString(result, (char *)hi->hi_key, newObj)) + if (PyDict_SetItemString(ret, (char *)hi->hi_key, newObj)) { - Py_DECREF(result); + Py_DECREF(ret); Py_DECREF(newObj); return NULL; } @@ -739,10 +739,10 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) else { Py_INCREF(Py_None); - result = Py_None; + ret = Py_None; } - return result; + return ret; } static PyObject * @@ -752,7 +752,7 @@ VimEval(PyObject *self UNUSED, PyObject *args) typval_T *our_tv; PyObject *string; PyObject *todecref; - PyObject *result; + PyObject *ret; PyObject *lookup_dict; if (!PyArg_ParseTuple(args, "O", &string)) @@ -782,10 +782,10 @@ VimEval(PyObject *self UNUSED, PyObject *args) /* Convert the Vim type into a Python type. Create a dictionary that's * used to check for recursive loops. */ if (!(lookup_dict = PyDict_New())) - result = NULL; + ret = NULL; else { - result = VimToPython(our_tv, 1, lookup_dict); + ret = VimToPython(our_tv, 1, lookup_dict); Py_DECREF(lookup_dict); } @@ -796,7 +796,7 @@ VimEval(PyObject *self UNUSED, PyObject *args) Python_Release_Vim(); Py_END_ALLOW_THREADS - return result; + return ret; } static PyObject *ConvertToPyObject(typval_T *); @@ -805,7 +805,7 @@ static PyObject *ConvertToPyObject(typval_T *); VimEvalPy(PyObject *self UNUSED, PyObject *string) { typval_T *our_tv; - PyObject *result; + PyObject *ret; char_u *expr; PyObject *todecref; @@ -830,14 +830,14 @@ VimEvalPy(PyObject *self UNUSED, PyObject *string) return NULL; } - result = ConvertToPyObject(our_tv); + ret = ConvertToPyObject(our_tv); Py_BEGIN_ALLOW_THREADS Python_Lock_Vim(); free_tv(our_tv); Python_Release_Vim(); Py_END_ALLOW_THREADS - return result; + return ret; } static PyObject * @@ -845,44 +845,44 @@ VimStrwidth(PyObject *self UNUSED, PyObject *string) { char_u *str; PyObject *todecref; - int result; + int len; if (!(str = StringToChars(string, &todecref))) return NULL; #ifdef FEAT_MBYTE - result = mb_string2cells(str, (int)STRLEN(str)); + len = mb_string2cells(str, (int)STRLEN(str)); #else - result = STRLEN(str); + len = STRLEN(str); #endif Py_XDECREF(todecref); - return PyLong_FromLong(result); + return PyLong_FromLong(len); } static PyObject * _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) { - PyObject *r; + PyObject *ret; PyObject *newwd; PyObject *todecref; char_u *new_dir; if (_chdir == NULL) return NULL; - if (!(r = PyObject_Call(_chdir, args, kwargs))) + if (!(ret = PyObject_Call(_chdir, args, kwargs))) return NULL; if (!(newwd = PyObject_CallFunctionObjArgs(py_getcwd, NULL))) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } if (!(new_dir = StringToChars(newwd, &todecref))) { - Py_DECREF(r); + Py_DECREF(ret); Py_DECREF(newwd); return NULL; } @@ -891,7 +891,7 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) if (vim_chdir(new_dir)) { - Py_DECREF(r); + Py_DECREF(ret); Py_DECREF(newwd); Py_XDECREF(todecref); @@ -909,11 +909,11 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) if (VimTryEnd()) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } - return r; + return ret; } static PyObject * @@ -1052,20 +1052,20 @@ map_finder_callback(char_u *path, void *_data) static PyObject * Vim_GetPaths(PyObject *self UNUSED) { - PyObject *r; + PyObject *ret; - if (!(r = PyList_New(0))) + if (!(ret = PyList_New(0))) return NULL; - do_in_runtimepath(NULL, FALSE, &map_finder_callback, r); + do_in_runtimepath(NULL, FALSE, &map_finder_callback, ret); if (PyErr_Occurred()) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } - return r; + return ret; } static PyObject * @@ -1400,16 +1400,16 @@ DictionaryNew(PyTypeObject *subtype, dict_T *dict) static dict_T * py_dict_alloc(void) { - dict_T *r; + dict_T *ret; - if (!(r = dict_alloc())) + if (!(ret = dict_alloc())) { PyErr_NoMemory(); return NULL; } - ++r->dv_refcount; + ++ret->dv_refcount; - return r; + return ret; } static PyObject * @@ -1461,9 +1461,9 @@ DictionaryDir(PyObject *self) } static int -DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) +DictionarySetattr(DictionaryObject *self, char *name, PyObject *valObject) { - if (val == NULL) + if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, "cannot delete vim.Dictionary attributes"); @@ -1479,7 +1479,7 @@ DictionarySetattr(DictionaryObject *self, char *name, PyObject *val) } else { - int istrue = PyObject_IsTrue(val); + int istrue = PyObject_IsTrue(valObject); if (istrue == -1) return -1; else if (istrue) @@ -1513,7 +1513,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) { PyObject *keyObject; PyObject *defObject = ((flags & DICT_FLAG_NONE_DEFAULT)? Py_None : NULL); - PyObject *r; + PyObject *ret; char_u *key; dictitem_T *di; dict_T *dict = self->dict; @@ -1566,7 +1566,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) di = dict_lookup(hi); - if (!(r = ConvertToPyObject(&di->di_tv))) + if (!(ret = ConvertToPyObject(&di->di_tv))) return NULL; if (flags & DICT_FLAG_POP) @@ -1574,7 +1574,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) if (dict->dv_lock) { RAISE_LOCKED_DICTIONARY; - Py_DECREF(r); + Py_DECREF(ret); return NULL; } @@ -1582,7 +1582,7 @@ _DictionaryItem(DictionaryObject *self, PyObject *args, int flags) dictitem_free(di); } - return r; + return ret; } static PyObject * @@ -1595,13 +1595,13 @@ DictionaryItem(DictionaryObject *self, PyObject *keyObject) DictionaryContains(DictionaryObject *self, PyObject *keyObject) { PyObject *rObj = _DictionaryItem(self, keyObject, DICT_FLAG_RETURN_BOOL); - int r; + int ret; - r = (rObj == Py_True); + ret = (rObj == Py_True); Py_DECREF(Py_True); - return r; + return ret; } typedef struct @@ -1616,7 +1616,7 @@ typedef struct static PyObject * DictionaryIterNext(dictiterinfo_T **dii) { - PyObject *r; + PyObject *ret; if (!(*dii)->todo) return NULL; @@ -1634,10 +1634,10 @@ DictionaryIterNext(dictiterinfo_T **dii) --((*dii)->todo); - if (!(r = PyBytes_FromString((char *) (*dii)->hi->hi_key))) + if (!(ret = PyBytes_FromString((char *) (*dii)->hi->hi_key))) return NULL; - return r; + return ret; } static PyObject * @@ -1753,26 +1753,26 @@ DictionaryListObjects(DictionaryObject *self, hi_to_py hiconvert) dict_T *dict = self->dict; long_u todo = dict->dv_hashtab.ht_used; Py_ssize_t i = 0; - PyObject *r; + PyObject *ret; hashitem_T *hi; PyObject *newObj; - r = PyList_New(todo); + ret = PyList_New(todo); for (hi = dict->dv_hashtab.ht_array; todo > 0; ++hi) { if (!HASHITEM_EMPTY(hi)) { if (!(newObj = hiconvert(hi))) { - Py_DECREF(r); + Py_DECREF(ret); return NULL; } - PyList_SET_ITEM(r, i, newObj); + PyList_SET_ITEM(ret, i, newObj); --todo; ++i; } } - return r; + return ret; } static PyObject * @@ -1807,7 +1807,7 @@ dict_item(hashitem_T *hi) { PyObject *keyObject; PyObject *valObject; - PyObject *r; + PyObject *ret; if (!(keyObject = dict_key(hi))) return NULL; @@ -1818,12 +1818,12 @@ dict_item(hashitem_T *hi) return NULL; } - r = Py_BuildValue("(OO)", keyObject, valObject); + ret = Py_BuildValue("(OO)", keyObject, valObject); Py_DECREF(keyObject); Py_DECREF(valObject); - return r; + return ret; } static PyObject * @@ -1858,19 +1858,19 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) } else { - PyObject *object; + PyObject *obj; - if (!PyArg_ParseTuple(args, "O", &object)) + if (!PyArg_ParseTuple(args, "O", &obj)) return NULL; - if (PyObject_HasAttrString(object, "keys")) - return DictionaryUpdate(self, NULL, object); + if (PyObject_HasAttrString(obj, "keys")) + return DictionaryUpdate(self, NULL, obj); else { PyObject *iterator; PyObject *item; - if (!(iterator = PyObject_GetIter(object))) + if (!(iterator = PyObject_GetIter(obj))) return NULL; while ((item = PyIter_Next(iterator))) @@ -1974,7 +1974,7 @@ DictionaryPop(DictionaryObject *self, PyObject *args) DictionaryPopItem(DictionaryObject *self) { hashitem_T *hi; - PyObject *r; + PyObject *ret; PyObject *valObject; dictitem_T *di; @@ -1993,7 +1993,7 @@ DictionaryPopItem(DictionaryObject *self) if (!(valObject = ConvertToPyObject(&di->di_tv))) return NULL; - if (!(r = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, valObject))) + if (!(ret = Py_BuildValue("(" Py_bytes_fmt "O)", hi->hi_key, valObject))) { Py_DECREF(valObject); return NULL; @@ -2002,7 +2002,7 @@ DictionaryPopItem(DictionaryObject *self) hash_remove(&self->dict->dv_hashtab, hi); dictitem_free(di); - return r; + return ret; } static PyObject * @@ -2075,16 +2075,16 @@ ListNew(PyTypeObject *subtype, list_T *list) static list_T * py_list_alloc() { - list_T *r; + list_T *ret; - if (!(r = list_alloc())) + if (!(ret = list_alloc())) { PyErr_NoMemory(); return NULL; } - ++r->lv_refcount; + ++ret->lv_refcount; - return r; + return ret; } static int @@ -2272,17 +2272,17 @@ ListIterDestruct(listiterinfo_T *lii) static PyObject * ListIterNext(listiterinfo_T **lii) { - PyObject *r; + PyObject *ret; if (!((*lii)->lw.lw_item)) return NULL; - if (!(r = ConvertToPyObject(&((*lii)->lw.lw_item->li_tv)))) + if (!(ret = ConvertToPyObject(&((*lii)->lw.lw_item->li_tv)))) return NULL; (*lii)->lw.lw_item = (*lii)->lw.lw_item->li_next; - return r; + return ret; } static PyObject * @@ -2319,7 +2319,7 @@ ListAssItem(ListObject *self, Py_ssize_t index, PyObject *obj) RAISE_LOCKED_LIST; return -1; } - if (index>length || (index==length && obj==NULL)) + if (index > length || (index == length && obj == NULL)) { PyErr_SET_STRING(PyExc_IndexError, "list index out of range"); return -1; @@ -2463,9 +2463,9 @@ ListDir(PyObject *self) } static int -ListSetattr(ListObject *self, char *name, PyObject *val) +ListSetattr(ListObject *self, char *name, PyObject *valObject) { - if (val == NULL) + if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, "cannot delete vim.List attributes"); @@ -2481,7 +2481,7 @@ ListSetattr(ListObject *self, char *name, PyObject *val) } else { - int istrue = PyObject_IsTrue(val); + int istrue = PyObject_IsTrue(valObject); if (istrue == -1) return -1; else if (istrue) @@ -2599,7 +2599,7 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) typval_T rettv; dict_T *selfdict = NULL; PyObject *selfdictObject; - PyObject *result; + PyObject *ret; int error; if (ConvertFromPyObject(argsObject, &args) == -1) @@ -2629,21 +2629,21 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) Py_END_ALLOW_THREADS if (VimTryEnd()) - result = NULL; + ret = NULL; else if (error != OK) { - result = NULL; + ret = NULL; PyErr_VIM_FORMAT("failed to run function %s", (char *)name); } else - result = ConvertToPyObject(&rettv); + ret = ConvertToPyObject(&rettv); clear_tv(&args); clear_tv(&rettv); if (selfdict != NULL) clear_tv(&selfdicttv); - return result; + return ret; } static PyObject * @@ -2761,10 +2761,10 @@ OptionsItem(OptionsObject *self, PyObject *keyObject) } else if (flags & SOPT_BOOL) { - PyObject *r; - r = numval ? Py_True : Py_False; - Py_INCREF(r); - return r; + PyObject *ret; + ret = numval ? Py_True : Py_False; + Py_INCREF(ret); + return ret; } else if (flags & SOPT_NUM) return PyInt_FromLong(numval); @@ -2772,9 +2772,9 @@ OptionsItem(OptionsObject *self, PyObject *keyObject) { if (stringval) { - PyObject *r = PyBytes_FromString((char *) stringval); + PyObject *ret = PyBytes_FromString((char *) stringval); vim_free(stringval); - return r; + return ret; } else { @@ -2817,7 +2817,7 @@ set_option_value_for( win_T *save_curwin = NULL; tabpage_T *save_curtab = NULL; buf_T *save_curbuf = NULL; - int r = 0; + int set_ret = 0; VimTryStart(); switch (opt_type) @@ -2831,24 +2831,20 @@ set_option_value_for( PyErr_SET_VIM("problem while switching windows"); return -1; } - r = set_option_value_err(key, numval, stringval, opt_flags); - restore_win(save_curwin, save_curtab, FALSE); - if (r == FAIL) - return -1; + set_ret = set_option_value_err(key, numval, stringval, opt_flags); + restore_win(save_curwin, save_curtab, TRUE); break; case SREQ_BUF: switch_buffer(&save_curbuf, (buf_T *)from); - r = set_option_value_err(key, numval, stringval, opt_flags); + set_ret = set_option_value_err(key, numval, stringval, opt_flags); restore_buffer(save_curbuf); - if (r == FAIL) - return -1; break; case SREQ_GLOBAL: - r = set_option_value_err(key, numval, stringval, opt_flags); - if (r == FAIL) - return -1; + set_ret = set_option_value_err(key, numval, stringval, opt_flags); break; } + if (set_ret == FAIL) + return -1; return VimTryEnd(); } @@ -2858,7 +2854,7 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) char_u *key; int flags; int opt_flags; - int r = 0; + int ret = 0; PyObject *todecref; if (self->Check(self->from)) @@ -2916,9 +2912,9 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) int istrue = PyObject_IsTrue(valObject); if (istrue == -1) - r = -1; + ret = -1; else - r = set_option_value_for(key, istrue, NULL, + ret = set_option_value_for(key, istrue, NULL, opt_flags, self->opt_type, self->from); } else if (flags & SOPT_NUM) @@ -2931,24 +2927,24 @@ OptionsAssItem(OptionsObject *self, PyObject *keyObject, PyObject *valObject) return -1; } - r = set_option_value_for(key, (int) val, NULL, opt_flags, + ret = set_option_value_for(key, (int) val, NULL, opt_flags, self->opt_type, self->from); } else { - char_u *val; + char_u *val; PyObject *todecref; if ((val = StringToChars(valObject, &todecref))) - r = set_option_value_for(key, 0, val, opt_flags, + ret = set_option_value_for(key, 0, val, opt_flags, self->opt_type, self->from); else - r = -1; + ret = -1; } Py_XDECREF(todecref); - return r; + return ret; } static PyMappingMethods OptionsAsMapping = { @@ -3027,14 +3023,14 @@ TabPageDir(PyObject *self) static PyObject * TabPageAttrValid(TabPageObject *self, char *name) { - PyObject *r; + PyObject *ret; if (strcmp(name, "valid") != 0) return NULL; - r = ((self->tab == INVALID_TABPAGE_VALUE) ? Py_False : Py_True); - Py_INCREF(r); - return r; + ret = ((self->tab == INVALID_TABPAGE_VALUE) ? Py_False : Py_True); + Py_INCREF(ret); + return ret; } static PyObject * @@ -3243,14 +3239,14 @@ WindowDir(PyObject *self) static PyObject * WindowAttrValid(WindowObject *self, char *name) { - PyObject *r; + PyObject *ret; if (strcmp(name, "valid") != 0) return NULL; - r = ((self->win == INVALID_WINDOW_VALUE) ? Py_False : Py_True); - Py_INCREF(r); - return r; + ret = ((self->win == INVALID_WINDOW_VALUE) ? Py_False : Py_True); + Py_INCREF(ret); + return ret; } static PyObject * @@ -3300,7 +3296,7 @@ WindowAttr(WindowObject *self, char *name) } static int -WindowSetattr(WindowObject *self, char *name, PyObject *val) +WindowSetattr(WindowObject *self, char *name, PyObject *valObject) { if (CheckWindow(self)) return -1; @@ -3315,7 +3311,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) long lnum; long col; - if (!PyArg_Parse(val, "(ll)", &lnum, &col)) + if (!PyArg_Parse(valObject, "(ll)", &lnum, &col)) return -1; if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count) @@ -3344,7 +3340,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) long height; win_T *savewin; - if (NumberToLong(val, &height, NUMBER_INT)) + if (NumberToLong(valObject, &height, NUMBER_INT)) return -1; #ifdef FEAT_GUI @@ -3367,7 +3363,7 @@ WindowSetattr(WindowObject *self, char *name, PyObject *val) long width; win_T *savewin; - if (NumberToLong(val, &width, NUMBER_INT)) + if (NumberToLong(valObject, &width, NUMBER_INT)) return -1; #ifdef FEAT_GUI @@ -3584,25 +3580,26 @@ GetBufferLine(buf_T *buf, PyInt n) static PyObject * GetBufferLineList(buf_T *buf, PyInt lo, PyInt hi) { - PyInt i; - PyInt n = hi - lo; - PyObject *list = PyList_New(n); + PyInt i; + PyInt n = hi - lo; + PyObject *list = PyList_New(n); if (list == NULL) return NULL; for (i = 0; i < n; ++i) { - PyObject *str = LineToString((char *)ml_get_buf(buf, (linenr_T)(lo+i), FALSE)); + PyObject *string = LineToString( + (char *)ml_get_buf(buf, (linenr_T)(lo+i), FALSE)); /* Error check - was the Python string creation OK? */ - if (str == NULL) + if (string == NULL) { Py_DECREF(list); return NULL; } - PyList_SET_ITEM(list, i, str); + PyList_SET_ITEM(list, i, string); } /* The ownership of the Python list is passed to the caller (ie, @@ -3662,7 +3659,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) */ if (line == Py_None || line == NULL) { - buf_T *savebuf; + buf_T *savebuf; PyErr_Clear(); switch_buffer(&savebuf, buf); @@ -3747,7 +3744,12 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) * is set to the change in the buffer length. */ static int -SetBufferLineList(buf_T *buf, PyInt lo, PyInt hi, PyObject *list, PyInt *len_change) +SetBufferLineList( + buf_T *buf, + PyInt lo, + PyInt hi, + PyObject *list, + PyInt *len_change) { /* First of all, we check the type of the supplied Python object. * There are three cases: @@ -4124,7 +4126,13 @@ RBSlice(BufferObject *self, PyInt lo, PyInt hi, PyInt start, PyInt end) } static PyInt -RBAsItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyInt *new_end) +RBAsItem( + BufferObject *self, + PyInt n, + PyObject *valObject, + PyInt start, + PyInt end, + PyInt *new_end) { PyInt len_change; @@ -4143,7 +4151,7 @@ RBAsItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyI return -1; } - if (SetBufferLine(self->buf, n+start, val, &len_change) == FAIL) + if (SetBufferLine(self->buf, n+start, valObject, &len_change) == FAIL) return -1; if (new_end) @@ -4153,7 +4161,14 @@ RBAsItem(BufferObject *self, PyInt n, PyObject *val, PyInt start, PyInt end, PyI } static PyInt -RBAsSlice(BufferObject *self, PyInt lo, PyInt hi, PyObject *val, PyInt start, PyInt end, PyInt *new_end) +RBAsSlice( + BufferObject *self, + PyInt lo, + PyInt hi, + PyObject *valObject, + PyInt start, + PyInt end, + PyInt *new_end) { PyInt size; PyInt len_change; @@ -4180,7 +4195,7 @@ RBAsSlice(BufferObject *self, PyInt lo, PyInt hi, PyObject *val, PyInt start, Py hi = size; if (SetBufferLineList(self->buf, lo + start, hi + start, - val, &len_change) == FAIL) + valObject, &len_change) == FAIL) return -1; if (new_end) @@ -4191,7 +4206,12 @@ RBAsSlice(BufferObject *self, PyInt lo, PyInt hi, PyObject *val, PyInt start, Py static PyObject * -RBAppend(BufferObject *self, PyObject *args, PyInt start, PyInt end, PyInt *new_end) +RBAppend( + BufferObject *self, + PyObject *args, + PyInt start, + PyInt end, + PyInt *new_end) { PyObject *lines; PyInt len_change; @@ -4438,14 +4458,14 @@ BufferDir(PyObject *self) static PyObject * BufferAttrValid(BufferObject *self, char *name) { - PyObject *r; + PyObject *ret; if (strcmp(name, "valid") != 0) return NULL; - r = ((self->buf == INVALID_BUFFER_VALUE) ? Py_False : Py_True); - Py_INCREF(r); - return r; + ret = ((self->buf == INVALID_BUFFER_VALUE) ? Py_False : Py_True); + Py_INCREF(ret); + return ret; } static PyObject * @@ -4475,9 +4495,9 @@ BufferSetattr(BufferObject *self, char *name, PyObject *valObject) if (strcmp(name, "name") == 0) { - char_u *val; + char_u *val; aco_save_T aco; - int r; + int ren_ret; PyObject *todecref; if (!(val = StringToChars(valObject, &todecref))) @@ -4486,13 +4506,13 @@ BufferSetattr(BufferObject *self, char *name, PyObject *valObject) VimTryStart(); /* Using aucmd_*: autocommands will be executed by rename_buffer */ aucmd_prepbuf(&aco, self->buf); - r = rename_buffer(val); + ren_ret = rename_buffer(val); aucmd_restbuf(&aco); Py_XDECREF(todecref); if (VimTryEnd()) return -1; - if (r == FAIL) + if (ren_ret == FAIL) { PyErr_SET_VIM("failed to rename buffer"); return -1; @@ -4677,27 +4697,27 @@ BufMapIterClear(PyObject **buffer) BufMapIterNext(PyObject **buffer) { PyObject *next; - PyObject *r; + PyObject *ret; if (!*buffer) return NULL; - r = *buffer; + ret = *buffer; - if (CheckBuffer((BufferObject *)(r))) + if (CheckBuffer((BufferObject *)(ret))) { *buffer = NULL; return NULL; } - if (!((BufferObject *)(r))->buf->b_next) + if (!((BufferObject *)(ret))->buf->b_next) next = NULL; - else if (!(next = BufferNew(((BufferObject *)(r))->buf->b_next))) + else if (!(next = BufferNew(((BufferObject *)(ret))->buf->b_next))) return NULL; *buffer = next; /* Do not increment reference: we no longer hold it (decref), but whoever * on other side will hold (incref). Decref+incref = nothing. */ - return r; + return ret; } static PyObject * @@ -4755,11 +4775,12 @@ CurrentGetattr(PyObject *self UNUSED, char *name) } static int -CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) +CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) { if (strcmp(name, "line") == 0) { - if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, value, NULL) == FAIL) + if (SetBufferLine(curbuf, (PyInt)curwin->w_cursor.lnum, valObject, + NULL) == FAIL) return -1; return 0; @@ -4768,17 +4789,17 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { int count; - if (value->ob_type != &BufferType) + if (valObject->ob_type != &BufferType) { PyErr_FORMAT(PyExc_TypeError, "expected vim.Buffer object, but got %s", - Py_TYPE_NAME(value)); + Py_TYPE_NAME(valObject)); return -1; } - if (CheckBuffer((BufferObject *)(value))) + if (CheckBuffer((BufferObject *)(valObject))) return -1; - count = ((BufferObject *)(value))->buf->b_fnum; + count = ((BufferObject *)(valObject))->buf->b_fnum; VimTryStart(); if (do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, count, 0) == FAIL) @@ -4795,17 +4816,17 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) { int count; - if (value->ob_type != &WindowType) + if (valObject->ob_type != &WindowType) { PyErr_FORMAT(PyExc_TypeError, "expected vim.Window object, but got %s", - Py_TYPE_NAME(value)); + Py_TYPE_NAME(valObject)); return -1; } - if (CheckWindow((WindowObject *)(value))) + if (CheckWindow((WindowObject *)(valObject))) return -1; - count = get_win_number(((WindowObject *)(value))->win, firstwin); + count = get_win_number(((WindowObject *)(valObject))->win, firstwin); if (!count) { @@ -4815,8 +4836,8 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) } VimTryStart(); - win_goto(((WindowObject *)(value))->win); - if (((WindowObject *)(value))->win != curwin) + win_goto(((WindowObject *)(valObject))->win); + if (((WindowObject *)(valObject))->win != curwin) { if (VimTryEnd()) return -1; @@ -4829,20 +4850,20 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *value) } else if (strcmp(name, "tabpage") == 0) { - if (value->ob_type != &TabPageType) + if (valObject->ob_type != &TabPageType) { PyErr_FORMAT(PyExc_TypeError, "expected vim.TabPage object, but got %s", - Py_TYPE_NAME(value)); + Py_TYPE_NAME(valObject)); return -1; } - if (CheckTabPage((TabPageObject *)(value))) + if (CheckTabPage((TabPageObject *)(valObject))) return -1; VimTryStart(); - goto_tabpage_tp(((TabPageObject *)(value))->tab, TRUE, TRUE); - if (((TabPageObject *)(value))->tab != curtab) + goto_tabpage_tp(((TabPageObject *)(valObject))->tab, TRUE, TRUE); + if (((TabPageObject *)(valObject))->tab != curtab) { if (VimTryEnd()) return -1; @@ -4934,7 +4955,9 @@ run_do(const char *cmd, void *arg UNUSED for (lnum = RangeStart; lnum <= RangeEnd; ++lnum) { - PyObject *line, *linenr, *ret; + PyObject *line; + PyObject *linenr; + PyObject *ret; #ifdef PY_CAN_RECURSE *pygilstate = PyGILState_Ensure(); @@ -4990,10 +5013,10 @@ run_eval(const char *cmd, typval_T *rettv #endif ) { - PyObject *r; + PyObject *run_ret; - r = PyRun_String((char *) cmd, Py_eval_input, globals, globals); - if (r == NULL) + run_ret = PyRun_String((char *) cmd, Py_eval_input, globals, globals); + if (run_ret == NULL) { if (PyErr_Occurred() && !msg_silent) PyErr_PrintEx(0); @@ -5001,9 +5024,9 @@ run_eval(const char *cmd, typval_T *rettv } else { - if (ConvertFromPyObject(r, rettv) == -1) + if (ConvertFromPyObject(run_ret, rettv) == -1) EMSG(_("E859: Failed to convert returned python object to vim value")); - Py_DECREF(r); + Py_DECREF(run_ret); } PyErr_Clear(); } @@ -5306,7 +5329,7 @@ convert_dl(PyObject *obj, typval_T *tv, ConvertFromPyMapping(PyObject *obj, typval_T *tv) { PyObject *lookup_dict; - int r; + int ret; if (!(lookup_dict = PyDict_New())) return -1; @@ -5316,34 +5339,34 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv) tv->v_type = VAR_DICT; tv->vval.v_dict = (((DictionaryObject *)(obj))->dict); ++tv->vval.v_dict->dv_refcount; - r = 0; + ret = 0; } else if (PyDict_Check(obj)) - r = convert_dl(obj, tv, pydict_to_tv, lookup_dict); + ret = convert_dl(obj, tv, pydict_to_tv, lookup_dict); else if (PyMapping_Check(obj)) - r = convert_dl(obj, tv, pymap_to_tv, lookup_dict); + ret = convert_dl(obj, tv, pymap_to_tv, lookup_dict); else { PyErr_FORMAT(PyExc_TypeError, "unable to convert %s to vim dictionary", Py_TYPE_NAME(obj)); - r = -1; + ret = -1; } Py_DECREF(lookup_dict); - return r; + return ret; } static int ConvertFromPyObject(PyObject *obj, typval_T *tv) { PyObject *lookup_dict; - int r; + int ret; if (!(lookup_dict = PyDict_New())) return -1; - r = _ConvertFromPyObject(obj, tv, lookup_dict); + ret = _ConvertFromPyObject(obj, tv, lookup_dict); Py_DECREF(lookup_dict); - return r; + return ret; } static int @@ -5371,14 +5394,14 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) } else if (PyBytes_Check(obj)) { - char_u *result; + char_u *str; - if (PyBytes_AsStringAndSize(obj, (char **) &result, NULL) == -1) + if (PyBytes_AsStringAndSize(obj, (char **) &str, NULL) == -1) return -1; - if (result == NULL) + if (str == NULL) return -1; - if (set_string_copy(result, tv) == -1) + if (set_string_copy(str, tv) == -1) return -1; tv->v_type = VAR_STRING; @@ -5386,18 +5409,18 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) else if (PyUnicode_Check(obj)) { PyObject *bytes; - char_u *result; + char_u *str; bytes = PyUnicode_AsEncodedString(obj, ENC_OPT, NULL); if (bytes == NULL) return -1; - if(PyBytes_AsStringAndSize(bytes, (char **) &result, NULL) == -1) + if(PyBytes_AsStringAndSize(bytes, (char **) &str, NULL) == -1) return -1; - if (result == NULL) + if (str == NULL) return -1; - if (set_string_copy(result, tv)) + if (set_string_copy(str, tv)) { Py_XDECREF(bytes); return -1; @@ -5852,7 +5875,7 @@ static TabListObject TheTabPageList = static struct numeric_constant { char *name; - int value; + int val; } numeric_constants[] = { {"VAR_LOCKED", VAR_LOCKED}, {"VAR_FIXED", VAR_FIXED}, @@ -5862,7 +5885,7 @@ static struct numeric_constant { static struct object_constant { char *name; - PyObject *value; + PyObject *valObject; } object_constants[] = { {"buffers", (PyObject *)(void *)&TheBufferMap}, {"windows", (PyObject *)(void *)&TheWindowList}, @@ -5889,10 +5912,10 @@ typedef PyObject *(*attr_getter)(PyObject *, const char *); #define ADD_CHECKED_OBJECT(m, name, obj) \ { \ - PyObject *value = obj; \ - if (!value) \ + PyObject *valObject = obj; \ + if (!valObject) \ return -1; \ - ADD_OBJECT(m, name, value); \ + ADD_OBJECT(m, name, valObject); \ } static int @@ -5907,17 +5930,17 @@ populate_module(PyObject *m, object_adder add_object, attr_getter get_attr) / sizeof(struct numeric_constant)); ++i) ADD_CHECKED_OBJECT(m, numeric_constants[i].name, - PyInt_FromLong(numeric_constants[i].value)); + PyInt_FromLong(numeric_constants[i].val)); for (i = 0; i < (int)(sizeof(object_constants) / sizeof(struct object_constant)); ++i) { - PyObject *value; + PyObject *valObject; - value = object_constants[i].value; - Py_INCREF(value); - ADD_OBJECT(m, object_constants[i].name, value); + valObject = object_constants[i].valObject; + Py_INCREF(valObject); + ADD_OBJECT(m, object_constants[i].name, valObject); } if (!(VimError = PyErr_NewException("vim.error", NULL, NULL))) diff --git a/src/version.c b/src/version.c index a775eae31e..bb95b5b18a 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1232, /**/ 1231, /**/ From 270e1b7795c8f24cef8d31bfc2f974e59f133ebe Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:30:47 +0200 Subject: [PATCH 18/20] Added tag v7-3-1232 for changeset a594ce86b5ea --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index b51cad73fd..298d9afb7b 100644 --- a/.hgtags +++ b/.hgtags @@ -2568,3 +2568,4 @@ b34d719b13cd9dd44485600e5cd939814b9b065f v7-3-1226 b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 537bbfff0c5c0bc2307a85133f59f07b00c55e41 v7-3-1231 +a594ce86b5eade96cb84415b3b027abe611c2238 v7-3-1232 From 6561c003373fc1e0cf5576061fbf0ac9f3209cb6 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:37:07 +0200 Subject: [PATCH 19/20] updated for version 7.3.1233 Problem: Various Python problems. Solution: Fix VimTryEnd. Crash with debug build and PYTHONDUMPREFS=1. Memory leaks in StringToLine(), BufferMark() and convert_dl. (ZyX) --- src/if_py_both.h | 37 ++- src/testdir/test86.in | 200 ++++++++++++--- src/testdir/test86.ok | 577 +++++++++++++++++++++--------------------- src/testdir/test87.in | 202 +++++++++++---- src/testdir/test87.ok | 577 +++++++++++++++++++++--------------------- src/version.c | 2 + 6 files changed, 929 insertions(+), 666 deletions(-) diff --git a/src/if_py_both.h b/src/if_py_both.h index 5319466e57..e48740c275 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -544,20 +544,30 @@ VimTryStart(void) VimTryEnd(void) { --trylevel; + /* Without this it stops processing all subsequent VimL commands and + * generates strange error messages if I e.g. try calling Test() in a cycle */ + did_emsg = FALSE; + /* Keyboard interrupt should be preferred over anything else */ if (got_int) { + did_throw = got_int = FALSE; PyErr_SetNone(PyExc_KeyboardInterrupt); - return 1; + return -1; } else if (!did_throw) - return 0; + return (PyErr_Occurred() ? -1 : 0); + /* Python exception is preferred over vim one; unlikely to occur though */ else if (PyErr_Occurred()) - return 1; + { + did_throw = FALSE; + return -1; + } + /* Finally transform VimL exception to python one */ else { PyErr_SetVim((char *) current_exception->value); discard_current_exception(); - return 1; + return -1; } } @@ -2649,7 +2659,14 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs) static PyObject * FunctionRepr(FunctionObject *self) { - return PyString_FromFormat("", self->name); +#ifdef Py_TRACE_REFS + /* For unknown reason self->name may be NULL after calling + * Finalize */ + return PyString_FromFormat("", + (self->name == NULL ? "" : (char *) self->name)); +#else + return PyString_FromFormat("", (char *) self->name); +#endif } static struct PyMethodDef FunctionMethods[] = { @@ -3534,6 +3551,7 @@ StringToLine(PyObject *obj) else { PyErr_SET_VIM("string cannot contain newlines"); + Py_XDECREF(bytes); return NULL; } } @@ -3545,6 +3563,7 @@ StringToLine(PyObject *obj) if (save == NULL) { PyErr_NoMemory(); + Py_XDECREF(bytes); return NULL; } @@ -4551,6 +4570,7 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) { PyErr_SET_STRING(PyExc_ValueError, "mark name must be a single character"); + Py_XDECREF(todecref); return NULL; } @@ -5298,6 +5318,9 @@ convert_dl(PyObject *obj, typval_T *tv, tv->v_type = VAR_UNKNOWN; return -1; } + + Py_DECREF(capsule); + if (py_to_tv(obj, tv, lookup_dict) == -1) { tv->v_type = VAR_UNKNOWN; @@ -5378,13 +5401,13 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) tv->vval.v_dict = (((DictionaryObject *)(obj))->dict); ++tv->vval.v_dict->dv_refcount; } - else if (obj->ob_type == &ListType) + else if (PyType_IsSubtype(obj->ob_type, &ListType)) { tv->v_type = VAR_LIST; tv->vval.v_list = (((ListObject *)(obj))->list); ++tv->vval.v_list->lv_refcount; } - else if (obj->ob_type == &FunctionType) + else if (PyType_IsSubtype(obj->ob_type, &FunctionType)) { if (set_string_copy(((FunctionObject *) (obj))->name, tv) == -1) return -1; diff --git a/src/testdir/test86.in b/src/testdir/test86.in index a46a70ac32..d8afc96d46 100644 --- a/src/testdir/test86.in +++ b/src/testdir/test86.in @@ -11,8 +11,8 @@ STARTTEST :set noswapfile :if !has('python') | e! test.ok | wq! test.out | endif :lang C -:py import vim :fun Test() +:py import vim :let l = [] :py l=vim.bindeval('l') :py f=vim.bindeval('function("strlen")') @@ -58,6 +58,9 @@ EOF : $put =string(key) . ' : ' . string(Val) : unlet key Val :endfor +:py del dk +:py del di +:py del dv :" :" removing items with del :py del l[2] @@ -176,12 +179,12 @@ EOF :unlockvar! l :" :" Function calls -:function New(...) -:return ['NewStart']+a:000+['NewEnd'] -:endfunction -:function DictNew(...) dict -:return ['DictNewStart']+a:000+['DictNewEnd', self] -:endfunction +:fun New(...) +: return ['NewStart']+a:000+['NewEnd'] +:endfun +:fun DictNew(...) dict +: return ['DictNewStart']+a:000+['DictNewEnd', self] +:endfun :let l=[function('New'), function('DictNew')] :py l=vim.bindeval('l') :py l.extend(list(l[0](1, 2, 3))) @@ -211,6 +214,7 @@ EOF : $put ='[0.0, 0.0]' :endif :let messages=[] +:delfunction DictNew py < 8 # check if the background thread is working +:py del time +:py del threading :$put =string(l) :" :" settrace @@ -333,6 +342,8 @@ def trace_main(): EOF :py sys.settrace(traceit) :py trace_main() +:py del traceit +:py del trace_main :py sys.settrace(None) :$put =string(l) :" @@ -363,7 +374,7 @@ EOF :" :" Vars :let g:foo = 'bac' -:let w:abc = 'def' +:let w:abc3 = 'def' :let b:baz = 'bar' :let t:bar = 'jkl' :try @@ -372,7 +383,7 @@ EOF : put =pyeval('vim.vvars[''exception'']') :endtry :put =pyeval('vim.vars[''foo'']') -:put =pyeval('vim.current.window.vars[''abc'']') +:put =pyeval('vim.current.window.vars[''abc3'']') :put =pyeval('vim.current.buffer.vars[''baz'']') :put =pyeval('vim.current.tabpage.vars[''bar'']') :" @@ -420,16 +431,16 @@ def ev(s, g=globals(), l=locals()): vim.command('let exc=' + repr(sys.exc_type.__name__)) return 0 EOF -:function E(s) +:fun E(s) : python e(vim.eval('a:s')) -:endfunction -:function Ev(s) +:endfun +:fun Ev(s) : let r=pyeval('ev(vim.eval("a:s"))') : if exists('exc') : throw exc : endif : return r -:endfunction +:endfun :py gopts1=vim.options :py wopts1=vim.windows[2].options :py wopts2=vim.windows[0].options @@ -444,7 +455,7 @@ EOF :let lst+=[['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0 ]] :let lst+=[['number', 0, 1, 1, 0, 1, 0, 1 ]] :let lst+=[['numberwidth', 2, 3, 5, -100, 0, 0, 1 ]] -:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]] +:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1 ]] :let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]] :let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]] :let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]] @@ -494,10 +505,27 @@ EOF : endfor : call RecVars(oname) :endfor +:delfunction RecVars +:delfunction E +:delfunction Ev +:py del ev +:py del e :only :for buf in g:bufs[1:] : execute 'bwipeout!' buf :endfor +:py del gopts1 +:py del wopts1 +:py del wopts2 +:py del wopts3 +:py del bopts1 +:py del bopts2 +:py del bopts3 +:py del oval1 +:py del oval2 +:py del oval3 +:py del oname +:py del invval :" :" Test buffer object :vnew @@ -517,7 +545,7 @@ cb = vim.current.buffer # Tests BufferAppend and BufferItem cb.append(b[0]) # Tests BufferSlice and BufferAssSlice -cb.append('abc') # Will be overwritten +cb.append('abc5') # Will be overwritten cb[-1:] = b[:-2] # Test BufferLength and BufferAssSlice cb.append('def') # Will not be overwritten @@ -541,13 +569,14 @@ b.name = 'bar' cb.append(b.name[-11:].replace(os.path.sep, '/')) cb.name = old_name cb.append(cb.name[-17:].replace(os.path.sep, '/')) +del old_name # Test CheckBuffer for _b in vim.buffers: if _b is not cb: vim.command('bwipeout! ' + str(_b.number)) del _b cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid))) -for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"'): +for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")', 'b.name = "!"'): try: exec(expr) except vim.error: @@ -557,6 +586,7 @@ for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")', 'b.name = "!"' # Should not happen in any case cb.append('No exception for ' + expr) vim.command('cd .') +del b EOF :augroup BUFS : autocmd! @@ -598,6 +628,7 @@ for b in vim.buffers: # Check indexing: vim.buffers[number].number == number cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b)) prevnum = b.number +del prevnum cb.append(str(len(vim.buffers))) @@ -621,6 +652,8 @@ try: next(i4) except StopIteration: cb.append('StopIteration') +del i4 +del bnums EOF :" :" Test vim.{tabpage,window}list and vim.{tabpage,window} objects @@ -663,7 +696,11 @@ for t in vim.tabpages: raise ValueError except Exception: cb.append('!!!!!! Error while getting attribute ' + attr + ': ' + sys.exc_type.__name__) + del aval + del attr w.cursor = (len(w.buffer), 0) +del W +del Cursor cb.append('Number of windows in current tab page: ' + str(len(vim.windows))) if list(vim.windows) != list(vim.current.tabpage.windows): cb.append('!!!!!! Windows differ') @@ -676,6 +713,7 @@ def H(o): cb.append('Current tab page: ' + repr(vim.current.tabpage)) cb.append('Current window: ' + repr(vim.current.window) + ': ' + H(vim.current.window) + ' is ' + H(vim.current.tabpage.window)) cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ ' is ' + H(vim.current.tabpage.window.buffer)) +del H # Assigning: fails try: vim.current.window = vim.tabpages[0].window @@ -687,6 +725,7 @@ for attr in ('window', 'tabpage', 'buffer'): setattr(vim.current, attr, None) except TypeError: cb.append('Type error at assigning None to vim.current.' + attr) +del attr # Assigning: success vim.current.tabpage = vim.tabpages[-2] @@ -702,8 +741,13 @@ ts = list(vim.tabpages) for b in vim.buffers: if b is not cb: vim.command('bwipeout! ' + str(b.number)) +del b cb.append('w.valid: ' + repr([w.valid for w in ws])) cb.append('t.valid: ' + repr([t.valid for t in ts])) +del w +del t +del ts +del ws EOF :tabonly! :only! @@ -722,6 +766,8 @@ for expr, attr in ( ('vim.current.tabpage', 'TabPage'), ): cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) +del expr +del attr EOF :" :" Test __dir__() method @@ -747,15 +793,15 @@ EOF :$put =string(pyeval('vim.Dictionary(a=1)')) :$put =string(pyeval('vim.Dictionary(((''a'', 1),))')) :$put =string(pyeval('vim.List()')) -:$put =string(pyeval('vim.List(iter(''abc''))')) +:$put =string(pyeval('vim.List(iter(''abc7''))')) :$put =string(pyeval('vim.Function(''tr'')')) :" :" Test stdout/stderr :redir => messages -:py sys.stdout.write('abc') ; sys.stdout.write('def') -:py sys.stderr.write('abc') ; sys.stderr.write('def') -:py sys.stdout.writelines(iter('abc')) -:py sys.stderr.writelines(iter('abc')) +:py sys.stdout.write('abc8') ; sys.stdout.write('def') +:py sys.stderr.write('abc9') ; sys.stderr.write('def') +:py sys.stdout.writelines(iter('abcA')) +:py sys.stderr.writelines(iter('abcB')) :redir END :$put =string(substitute(messages, '\d\+', '', 'g')) :" Test subclassing @@ -776,7 +822,7 @@ class DupList(vim.List): return [super(DupList, self).__getitem__(idx)] * 2 dl = DupList() -dl2 = DupList(iter('abc')) +dl2 = DupList(iter('abcC')) dl.extend(dl2[0]) class DupFun(vim.Function): @@ -789,6 +835,19 @@ EOF :$put =string(pyeval('dl')) :$put =string(pyeval('dl2')) :$put =string(pyeval('df(2)')) +:$put =string(pyeval('dl') is# pyeval('dl')) +:$put =string(pyeval('dd') is# pyeval('dd')) +:$put =string(pyeval('df')) +:delfunction Put +py << EOF +del DupDict +del DupList +del DupFun +del dd +del dl +del dl2 +del df +EOF :" :" Test chdir py << EOF @@ -802,6 +861,7 @@ cb.append(vim.eval('@%').replace(os.path.sep, '/')) os.chdir('testdir') cb.append(fnamemodify('.', ':p:h:t')) cb.append(vim.eval('@%')) +del fnamemodify EOF :" :" Test errors @@ -828,11 +888,11 @@ def ee(expr, g=globals(), l=locals()): else: cb.append(expr + ':NOT FAILED') d = vim.Dictionary() -ned = vim.Dictionary(foo='bar', baz='abc') +ned = vim.Dictionary(foo='bar', baz='abcD') dl = vim.Dictionary(a=1) dl.locked = True l = vim.List() -ll = vim.List('abc') +ll = vim.List('abcE') ll.locked = True f = vim.Function('string') fd = vim.Function('F') @@ -869,11 +929,11 @@ def convertfrompyobject_test(expr, recurse=True): # pydict_to_tv stringtochars_test(expr % '{%s : 1}') if recurse: - convertfrompyobject_test(expr % '{"abc" : %s}', False) + convertfrompyobject_test(expr % '{"abcF" : %s}', False) # pymap_to_tv stringtochars_test(expr % 'Mapping({%s : 1})') if recurse: - convertfrompyobject_test(expr % 'Mapping({"abc" : %s})', False) + convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False) # pyseq_to_tv iter_test(expr) return subexpr_test(expr, 'ConvertFromPyObject', ( @@ -916,7 +976,7 @@ class FailingMappingKey(object): raise NotImplementedError def keys(self): - return list("abc") + return list("abcH") class FailingMapping(object): def __getitem__(self): @@ -958,7 +1018,7 @@ cb.append("> VimStrwidth") ee('vim.strwidth(1)') cb.append("> Dictionary") cb.append(">> DictionaryConstructor") -ee('vim.Dictionary("abc")') +ee('vim.Dictionary("abcI")') ##! Not checked: py_dict_alloc failure cb.append(">> DictionarySetattr") ee('del d.locked') @@ -973,6 +1033,7 @@ ee('d.pop("a")') ee('dl.pop("a")') cb.append(">> DictionaryIterNext") ee('for i in ned: ned["a"] = 1') +del i cb.append(">> DictionaryAssItem") ee('dl["b"] = 1') stringtochars_test('d[%s] = 1') @@ -1002,7 +1063,7 @@ cb.append(">> ListAssItem") ee('ll[1] = 2') ee('l[1000] = 3') cb.append(">> ListAssSlice") -ee('ll[1:100] = "abc"') +ee('ll[1:100] = "abcJ"') #iter_test('l[:] = %s') convertfrompyobject_test('l[:] = [%s]') cb.append(">> ListConcatInPlace") @@ -1033,8 +1094,8 @@ cb.append(">> WindowSetattr") ee('vim.current.window.buffer = 0') ee('vim.current.window.cursor = (100000000, 100000000)') ee('vim.current.window.cursor = True') -ee('vim.current.window.height = "abc"') -ee('vim.current.window.width = "abc"') +ee('vim.current.window.height = "abcK"') +ee('vim.current.window.width = "abcL"') ee('vim.current.window.xxxxxx = True') cb.append("> WinList") cb.append(">> WinListItem") @@ -1044,7 +1105,7 @@ cb.append(">> StringToLine (indirect)") ee('vim.current.buffer[0] = "\\na"') cb.append(">> SetBufferLine (indirect)") ee('vim.current.buffer[0] = True') -cb.append(">> SetBufferLines (indirect)") +cb.append(">> SetBufferLineList (indirect)") ee('vim.current.buffer[:] = True') ee('vim.current.buffer[:] = ["\\na", "bc"]') cb.append(">> InsertBufferLines (indirect)") @@ -1062,7 +1123,7 @@ ee('vim.current.buffer.name = True') ee('vim.current.buffer.xxx = True') cb.append(">> BufferMark") ee('vim.current.buffer.mark(0)') -ee('vim.current.buffer.mark("abc")') +ee('vim.current.buffer.mark("abcM")') ee('vim.current.buffer.mark("!")') cb.append(">> BufferRange") ee('vim.current.buffer.range(1, 2, 3)') @@ -1079,7 +1140,28 @@ ee('vim.current.buffer = True') ee('vim.current.window = True') ee('vim.current.tabpage = True') ee('vim.current.xxx = True') +del d +del ned +del dl +del l +del ll +del f +del fd +del fdel +del subexpr_test +del stringtochars_test +del Mapping +del convertfrompyobject_test +del convertfrompymapping_test +del iter_test +del FailingTrue +del FailingIter +del FailingIterNext +del FailingMapping +del FailingMappingKey +del FailingList EOF +:delfunction F :" :" Test import py << EOF @@ -1093,6 +1175,10 @@ import before cb.append(before.dir) import after cb.append(after.dir) +del before +del after +del d +del ddir EOF :" :" Test exceptions @@ -1101,18 +1187,48 @@ EOF :endfun py << EOF Exe = vim.bindeval('function("Exe")') -ee('vim.command("throw \'abc\'")') +ee('vim.command("throw \'abcN\'")') ee('Exe("throw \'def\'")') ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")') ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")') ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")') ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")') +del Exe +EOF +:delfunction Exe +:" +:" Cleanup +py << EOF +del cb +del ee +del sys +del os +del vim EOF :endfun :" -:call Test() +:fun RunTest() +:let checkrefs = !empty($PYTHONDUMPREFS) +:let start = getline(1, '$') +:for i in range(checkrefs ? 10 : 1) +: if i != 0 +: %d _ +: call setline(1, start) +: endif +: call Test() +: if i == 0 +: let result = getline(1, '$') +: endif +:endfor +:if checkrefs +: %d _ +: call setline(1, result) +:endif +:endfun :" -:delfunc Test +:call RunTest() +:delfunction RunTest +:delfunction Test :call garbagecollect(1) :" :/^start:/,$wq! test.out diff --git a/src/testdir/test86.ok b/src/testdir/test86.ok index ab6017be5f..b4abcc28c9 100644 --- a/src/testdir/test86.ok +++ b/src/testdir/test86.ok @@ -68,7 +68,7 @@ d : locked:0;scope:0 dl : locked:1;scope:0 v: : locked:2;scope:1 g: : locked:0;scope:2 -d:{'abc': 1} +d:{'abc2': 1} dl:{'def': 1} l : locked:0 ll : locked:1 @@ -202,12 +202,12 @@ jkl B: 1:3 2:5 3:2 4:8 >>> colorcolumn p/gopts1! KeyError - inv: 'abc'! KeyError + inv: 'abc4'! KeyError gopts1! KeyError p/wopts1: '' - inv: 'abc'! error + inv: 'abc4'! error p/bopts1! KeyError - inv: 'abc'! KeyError + inv: 'abc4'! KeyError bopts1! KeyError bopts2! KeyError bopts3! KeyError @@ -415,20 +415,23 @@ output:__dir__,__members__,flush,softspace,write,writelines {'a': 1} {'a': 1} [] -['a', 'b', 'c'] +['a', 'b', 'c', '7'] function('tr') ' abcdef line : abcdef -abc +abcA line : -abc' +abcB' ['a', 'dup_a'] ['a', 'a'] -['a', 'b', 'c'] +['a', 'b', 'c', 'C'] [2, 2] [2, 2] +1 +1 +function('Put') testdir test86.in src @@ -456,7 +459,7 @@ vim.bindeval(1):TypeError:('expected str() or unicode() instance, but got int',) vim.strwidth(1):TypeError:('expected str() or unicode() instance, but got int',) > Dictionary >> DictionaryConstructor -vim.Dictionary("abc"):ValueError:('expected sequence element of size 2, but got sequence of size 1',) +vim.Dictionary("abcI"):ValueError:('expected sequence element of size 2, but got sequence of size 1',) >> DictionarySetattr del d.locked:AttributeError:('cannot delete vim.Dictionary attributes',) d.locked = FailingTrue():NotImplementedError:() @@ -486,52 +489,52 @@ d["a"] = {1 : 1}:TypeError:('expected str() or unicode() instance, but got int', d["a"] = {u"\0" : 1}:TypeError:('expected string without null bytes',) d["a"] = {"\0" : 1}:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}} -d["a"] = {"abc" : {1 : 1}}:TypeError:('expected str() or unicode() instance, but got int',) -d["a"] = {"abc" : {u"\0" : 1}}:TypeError:('expected string without null bytes',) -d["a"] = {"abc" : {"\0" : 1}}:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d["a"] = {"abcF" : {%s : 1}} +d["a"] = {"abcF" : {1 : 1}}:TypeError:('expected str() or unicode() instance, but got int',) +d["a"] = {"abcF" : {u"\0" : 1}}:TypeError:('expected string without null bytes',) +d["a"] = {"abcF" : {"\0" : 1}}:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})} -d["a"] = {"abc" : Mapping({1 : 1})}:TypeError:('expected str() or unicode() instance, but got int',) -d["a"] = {"abc" : Mapping({u"\0" : 1})}:TypeError:('expected string without null bytes',) -d["a"] = {"abc" : Mapping({"\0" : 1})}:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d["a"] = {"abcF" : Mapping({%s : 1})} +d["a"] = {"abcF" : Mapping({1 : 1})}:TypeError:('expected str() or unicode() instance, but got int',) +d["a"] = {"abcF" : Mapping({u"\0" : 1})}:TypeError:('expected string without null bytes',) +d["a"] = {"abcF" : Mapping({"\0" : 1})}:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d["a"] = {"abc" : %s} -d["a"] = {"abc" : FailingIter()}:TypeError:('unable to convert FailingIter to vim structure',) -d["a"] = {"abc" : FailingIterNext()}:NotImplementedError:() +>>> Testing *Iter* using d["a"] = {"abcF" : %s} +d["a"] = {"abcF" : FailingIter()}:TypeError:('unable to convert FailingIter to vim structure',) +d["a"] = {"abcF" : FailingIterNext()}:NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s} -d["a"] = {"abc" : None}:TypeError:('unable to convert NoneType to vim structure',) -d["a"] = {"abc" : {"": 1}}:ValueError:('empty keys are not allowed',) -d["a"] = {"abc" : {u"": 1}}:ValueError:('empty keys are not allowed',) -d["a"] = {"abc" : FailingMapping()}:NotImplementedError:() -d["a"] = {"abc" : FailingMappingKey()}:NotImplementedError:() +>>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s} +d["a"] = {"abcF" : None}:TypeError:('unable to convert NoneType to vim structure',) +d["a"] = {"abcF" : {"": 1}}:ValueError:('empty keys are not allowed',) +d["a"] = {"abcF" : {u"": 1}}:ValueError:('empty keys are not allowed',) +d["a"] = {"abcF" : FailingMapping()}:NotImplementedError:() +d["a"] = {"abcF" : FailingMappingKey()}:NotImplementedError:() <<< Finished >>> Testing StringToChars using d["a"] = Mapping({%s : 1}) d["a"] = Mapping({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) d["a"] = Mapping({u"\0" : 1}):TypeError:('expected string without null bytes',) d["a"] = Mapping({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}}) -d["a"] = Mapping({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) -d["a"] = Mapping({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) -d["a"] = Mapping({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d["a"] = Mapping({"abcG" : {%s : 1}}) +d["a"] = Mapping({"abcG" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) +d["a"] = Mapping({"abcG" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) +d["a"] = Mapping({"abcG" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})}) -d["a"] = Mapping({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) -d["a"] = Mapping({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) -d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d["a"] = Mapping({"abcG" : Mapping({%s : 1})}) +d["a"] = Mapping({"abcG" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) +d["a"] = Mapping({"abcG" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) +d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) -d["a"] = Mapping({"abc" : FailingIterNext()}):NotImplementedError:() +>>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s}) +d["a"] = Mapping({"abcG" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) +d["a"] = Mapping({"abcG" : FailingIterNext()}):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) -d["a"] = Mapping({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) -d["a"] = Mapping({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) -d["a"] = Mapping({"abc" : FailingMapping()}):NotImplementedError:() -d["a"] = Mapping({"abc" : FailingMappingKey()}):NotImplementedError:() +>>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s}) +d["a"] = Mapping({"abcG" : None}):TypeError:('unable to convert NoneType to vim structure',) +d["a"] = Mapping({"abcG" : {"": 1}}):ValueError:('empty keys are not allowed',) +d["a"] = Mapping({"abcG" : {u"": 1}}):ValueError:('empty keys are not allowed',) +d["a"] = Mapping({"abcG" : FailingMapping()}):NotImplementedError:() +d["a"] = Mapping({"abcG" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing *Iter* using d["a"] = %s d["a"] = FailingIter():TypeError:('unable to convert FailingIter to vim structure',) @@ -554,52 +557,52 @@ d.update({1 : 1}):TypeError:('expected str() or unicode() instance, but got int' d.update({u"\0" : 1}):TypeError:('expected string without null bytes',) d.update({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update({"abc" : {%s : 1}}) -d.update({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) -d.update({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) -d.update({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update({"abcF" : {%s : 1}}) +d.update({"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) +d.update({"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) +d.update({"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})}) -d.update({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) -d.update({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) -d.update({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update({"abcF" : Mapping({%s : 1})}) +d.update({"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) +d.update({"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) +d.update({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d.update({"abc" : %s}) -d.update({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) -d.update({"abc" : FailingIterNext()}):NotImplementedError:() +>>> Testing *Iter* using d.update({"abcF" : %s}) +d.update({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) +d.update({"abcF" : FailingIterNext()}):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d.update({"abc" : %s}) -d.update({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) -d.update({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) -d.update({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) -d.update({"abc" : FailingMapping()}):NotImplementedError:() -d.update({"abc" : FailingMappingKey()}):NotImplementedError:() +>>> Testing ConvertFromPyObject using d.update({"abcF" : %s}) +d.update({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +d.update({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) +d.update({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) +d.update({"abcF" : FailingMapping()}):NotImplementedError:() +d.update({"abcF" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using d.update(Mapping({%s : 1})) d.update(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) d.update(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) d.update(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}})) -d.update(Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) -d.update(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) -d.update(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update(Mapping({"abcG" : {%s : 1}})) +d.update(Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) +d.update(Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) +d.update(Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})})) -d.update(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) -d.update(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) -d.update(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update(Mapping({"abcG" : Mapping({%s : 1})})) +d.update(Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) +d.update(Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) +d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) -d.update(Mapping({"abc" : FailingIterNext()})):NotImplementedError:() +>>> Testing *Iter* using d.update(Mapping({"abcG" : %s})) +d.update(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) +d.update(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) -d.update(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) -d.update(Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) -d.update(Mapping({"abc" : FailingMapping()})):NotImplementedError:() -d.update(Mapping({"abc" : FailingMappingKey()})):NotImplementedError:() +>>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s})) +d.update(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +d.update(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) +d.update(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) +d.update(Mapping({"abcG" : FailingMapping()})):NotImplementedError:() +d.update(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:() <<< Finished >>> Testing *Iter* using d.update(%s) d.update(FailingIter()):NotImplementedError:() @@ -622,52 +625,52 @@ d.update((("a", {1 : 1}),)):TypeError:('expected str() or unicode() instance, bu d.update((("a", {u"\0" : 1}),)):TypeError:('expected string without null bytes',) d.update((("a", {"\0" : 1}),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),)) -d.update((("a", {"abc" : {1 : 1}}),)):TypeError:('expected str() or unicode() instance, but got int',) -d.update((("a", {"abc" : {u"\0" : 1}}),)):TypeError:('expected string without null bytes',) -d.update((("a", {"abc" : {"\0" : 1}}),)):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update((("a", {"abcF" : {%s : 1}}),)) +d.update((("a", {"abcF" : {1 : 1}}),)):TypeError:('expected str() or unicode() instance, but got int',) +d.update((("a", {"abcF" : {u"\0" : 1}}),)):TypeError:('expected string without null bytes',) +d.update((("a", {"abcF" : {"\0" : 1}}),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),)) -d.update((("a", {"abc" : Mapping({1 : 1})}),)):TypeError:('expected str() or unicode() instance, but got int',) -d.update((("a", {"abc" : Mapping({u"\0" : 1})}),)):TypeError:('expected string without null bytes',) -d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update((("a", {"abcF" : Mapping({%s : 1})}),)) +d.update((("a", {"abcF" : Mapping({1 : 1})}),)):TypeError:('expected str() or unicode() instance, but got int',) +d.update((("a", {"abcF" : Mapping({u"\0" : 1})}),)):TypeError:('expected string without null bytes',) +d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : FailingIter()}),)):TypeError:('unable to convert FailingIter to vim structure',) -d.update((("a", {"abc" : FailingIterNext()}),)):NotImplementedError:() +>>> Testing *Iter* using d.update((("a", {"abcF" : %s}),)) +d.update((("a", {"abcF" : FailingIter()}),)):TypeError:('unable to convert FailingIter to vim structure',) +d.update((("a", {"abcF" : FailingIterNext()}),)):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : None}),)):TypeError:('unable to convert NoneType to vim structure',) -d.update((("a", {"abc" : {"": 1}}),)):ValueError:('empty keys are not allowed',) -d.update((("a", {"abc" : {u"": 1}}),)):ValueError:('empty keys are not allowed',) -d.update((("a", {"abc" : FailingMapping()}),)):NotImplementedError:() -d.update((("a", {"abc" : FailingMappingKey()}),)):NotImplementedError:() +>>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),)) +d.update((("a", {"abcF" : None}),)):TypeError:('unable to convert NoneType to vim structure',) +d.update((("a", {"abcF" : {"": 1}}),)):ValueError:('empty keys are not allowed',) +d.update((("a", {"abcF" : {u"": 1}}),)):ValueError:('empty keys are not allowed',) +d.update((("a", {"abcF" : FailingMapping()}),)):NotImplementedError:() +d.update((("a", {"abcF" : FailingMappingKey()}),)):NotImplementedError:() <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),)) d.update((("a", Mapping({1 : 1})),)):TypeError:('expected str() or unicode() instance, but got int',) d.update((("a", Mapping({u"\0" : 1})),)):TypeError:('expected string without null bytes',) d.update((("a", Mapping({"\0" : 1})),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),)) -d.update((("a", Mapping({"abc" : {1 : 1}})),)):TypeError:('expected str() or unicode() instance, but got int',) -d.update((("a", Mapping({"abc" : {u"\0" : 1}})),)):TypeError:('expected string without null bytes',) -d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update((("a", Mapping({"abcG" : {%s : 1}})),)) +d.update((("a", Mapping({"abcG" : {1 : 1}})),)):TypeError:('expected str() or unicode() instance, but got int',) +d.update((("a", Mapping({"abcG" : {u"\0" : 1}})),)):TypeError:('expected string without null bytes',) +d.update((("a", Mapping({"abcG" : {"\0" : 1}})),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),)) -d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):TypeError:('expected str() or unicode() instance, but got int',) -d.update((("a", Mapping({"abc" : Mapping({u"\0" : 1})})),)):TypeError:('expected string without null bytes',) -d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using d.update((("a", Mapping({"abcG" : Mapping({%s : 1})})),)) +d.update((("a", Mapping({"abcG" : Mapping({1 : 1})})),)):TypeError:('expected str() or unicode() instance, but got int',) +d.update((("a", Mapping({"abcG" : Mapping({u"\0" : 1})})),)):TypeError:('expected string without null bytes',) +d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : FailingIter()})),)):TypeError:('unable to convert FailingIter to vim structure',) -d.update((("a", Mapping({"abc" : FailingIterNext()})),)):NotImplementedError:() +>>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),)) +d.update((("a", Mapping({"abcG" : FailingIter()})),)):TypeError:('unable to convert FailingIter to vim structure',) +d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : None})),)):TypeError:('unable to convert NoneType to vim structure',) -d.update((("a", Mapping({"abc" : {"": 1}})),)):ValueError:('empty keys are not allowed',) -d.update((("a", Mapping({"abc" : {u"": 1}})),)):ValueError:('empty keys are not allowed',) -d.update((("a", Mapping({"abc" : FailingMapping()})),)):NotImplementedError:() -d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):NotImplementedError:() +>>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),)) +d.update((("a", Mapping({"abcG" : None})),)):TypeError:('unable to convert NoneType to vim structure',) +d.update((("a", Mapping({"abcG" : {"": 1}})),)):ValueError:('empty keys are not allowed',) +d.update((("a", Mapping({"abcG" : {u"": 1}})),)):ValueError:('empty keys are not allowed',) +d.update((("a", Mapping({"abcG" : FailingMapping()})),)):NotImplementedError:() +d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):NotImplementedError:() <<< Finished >>> Testing *Iter* using d.update((("a", %s),)) d.update((("a", FailingIter()),)):TypeError:('unable to convert FailingIter to vim structure',) @@ -693,52 +696,52 @@ vim.List([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got in vim.List([{u"\0" : 1}]):TypeError:('expected string without null bytes',) vim.List([{"\0" : 1}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}]) -vim.List([{"abc" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) -vim.List([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) -vim.List([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using vim.List([{"abcF" : {%s : 1}}]) +vim.List([{"abcF" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) +vim.List([{"abcF" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) +vim.List([{"abcF" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}]) -vim.List([{"abc" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) -vim.List([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) -vim.List([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using vim.List([{"abcF" : Mapping({%s : 1})}]) +vim.List([{"abcF" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) +vim.List([{"abcF" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) +vim.List([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using vim.List([{"abc" : %s}]) -vim.List([{"abc" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) -vim.List([{"abc" : FailingIterNext()}]):NotImplementedError:() +>>> Testing *Iter* using vim.List([{"abcF" : %s}]) +vim.List([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) +vim.List([{"abcF" : FailingIterNext()}]):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using vim.List([{"abc" : %s}]) -vim.List([{"abc" : None}]):TypeError:('unable to convert NoneType to vim structure',) -vim.List([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',) -vim.List([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',) -vim.List([{"abc" : FailingMapping()}]):NotImplementedError:() -vim.List([{"abc" : FailingMappingKey()}]):NotImplementedError:() +>>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}]) +vim.List([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',) +vim.List([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',) +vim.List([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',) +vim.List([{"abcF" : FailingMapping()}]):NotImplementedError:() +vim.List([{"abcF" : FailingMappingKey()}]):NotImplementedError:() <<< Finished >>> Testing StringToChars using vim.List([Mapping({%s : 1})]) vim.List([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',) vim.List([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',) vim.List([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})]) -vim.List([Mapping({"abc" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) -vim.List([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) -vim.List([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using vim.List([Mapping({"abcG" : {%s : 1}})]) +vim.List([Mapping({"abcG" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) +vim.List([Mapping({"abcG" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) +vim.List([Mapping({"abcG" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})]) -vim.List([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) -vim.List([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) -vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using vim.List([Mapping({"abcG" : Mapping({%s : 1})})]) +vim.List([Mapping({"abcG" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) +vim.List([Mapping({"abcG" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) +vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) -vim.List([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:() +>>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})]) +vim.List([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) +vim.List([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : None})]):TypeError:('unable to convert NoneType to vim structure',) -vim.List([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',) -vim.List([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',) -vim.List([Mapping({"abc" : FailingMapping()})]):NotImplementedError:() -vim.List([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:() +>>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})]) +vim.List([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',) +vim.List([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',) +vim.List([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',) +vim.List([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:() +vim.List([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:() <<< Finished >>> Testing *Iter* using vim.List([%s]) vim.List([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',) @@ -757,58 +760,58 @@ l[1000]:IndexError:('list index out of range',) ll[1] = 2:error:('list is locked',) l[1000] = 3:IndexError:('list index out of range',) >> ListAssSlice -ll[1:100] = "abc":error:('list is locked',) +ll[1:100] = "abcJ":error:('list is locked',) >>> Testing StringToChars using l[:] = [{%s : 1}] l[:] = [{1 : 1}]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [{u"\0" : 1}]:TypeError:('expected string without null bytes',) l[:] = [{"\0" : 1}]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}] -l[:] = [{"abc" : {1 : 1}}]:TypeError:('expected str() or unicode() instance, but got int',) -l[:] = [{"abc" : {u"\0" : 1}}]:TypeError:('expected string without null bytes',) -l[:] = [{"abc" : {"\0" : 1}}]:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l[:] = [{"abcF" : {%s : 1}}] +l[:] = [{"abcF" : {1 : 1}}]:TypeError:('expected str() or unicode() instance, but got int',) +l[:] = [{"abcF" : {u"\0" : 1}}]:TypeError:('expected string without null bytes',) +l[:] = [{"abcF" : {"\0" : 1}}]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}] -l[:] = [{"abc" : Mapping({1 : 1})}]:TypeError:('expected str() or unicode() instance, but got int',) -l[:] = [{"abc" : Mapping({u"\0" : 1})}]:TypeError:('expected string without null bytes',) -l[:] = [{"abc" : Mapping({"\0" : 1})}]:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l[:] = [{"abcF" : Mapping({%s : 1})}] +l[:] = [{"abcF" : Mapping({1 : 1})}]:TypeError:('expected str() or unicode() instance, but got int',) +l[:] = [{"abcF" : Mapping({u"\0" : 1})}]:TypeError:('expected string without null bytes',) +l[:] = [{"abcF" : Mapping({"\0" : 1})}]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : FailingIter()}]:TypeError:('unable to convert FailingIter to vim structure',) -l[:] = [{"abc" : FailingIterNext()}]:NotImplementedError:() +>>> Testing *Iter* using l[:] = [{"abcF" : %s}] +l[:] = [{"abcF" : FailingIter()}]:TypeError:('unable to convert FailingIter to vim structure',) +l[:] = [{"abcF" : FailingIterNext()}]:NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : None}]:TypeError:('unable to convert NoneType to vim structure',) -l[:] = [{"abc" : {"": 1}}]:ValueError:('empty keys are not allowed',) -l[:] = [{"abc" : {u"": 1}}]:ValueError:('empty keys are not allowed',) -l[:] = [{"abc" : FailingMapping()}]:NotImplementedError:() -l[:] = [{"abc" : FailingMappingKey()}]:NotImplementedError:() +>>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}] +l[:] = [{"abcF" : None}]:TypeError:('unable to convert NoneType to vim structure',) +l[:] = [{"abcF" : {"": 1}}]:ValueError:('empty keys are not allowed',) +l[:] = [{"abcF" : {u"": 1}}]:ValueError:('empty keys are not allowed',) +l[:] = [{"abcF" : FailingMapping()}]:NotImplementedError:() +l[:] = [{"abcF" : FailingMappingKey()}]:NotImplementedError:() <<< Finished >>> Testing StringToChars using l[:] = [Mapping({%s : 1})] l[:] = [Mapping({1 : 1})]:TypeError:('expected str() or unicode() instance, but got int',) l[:] = [Mapping({u"\0" : 1})]:TypeError:('expected string without null bytes',) l[:] = [Mapping({"\0" : 1})]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})] -l[:] = [Mapping({"abc" : {1 : 1}})]:TypeError:('expected str() or unicode() instance, but got int',) -l[:] = [Mapping({"abc" : {u"\0" : 1}})]:TypeError:('expected string without null bytes',) -l[:] = [Mapping({"abc" : {"\0" : 1}})]:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l[:] = [Mapping({"abcG" : {%s : 1}})] +l[:] = [Mapping({"abcG" : {1 : 1}})]:TypeError:('expected str() or unicode() instance, but got int',) +l[:] = [Mapping({"abcG" : {u"\0" : 1}})]:TypeError:('expected string without null bytes',) +l[:] = [Mapping({"abcG" : {"\0" : 1}})]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})] -l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:TypeError:('expected str() or unicode() instance, but got int',) -l[:] = [Mapping({"abc" : Mapping({u"\0" : 1})})]:TypeError:('expected string without null bytes',) -l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l[:] = [Mapping({"abcG" : Mapping({%s : 1})})] +l[:] = [Mapping({"abcG" : Mapping({1 : 1})})]:TypeError:('expected str() or unicode() instance, but got int',) +l[:] = [Mapping({"abcG" : Mapping({u"\0" : 1})})]:TypeError:('expected string without null bytes',) +l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : FailingIter()})]:TypeError:('unable to convert FailingIter to vim structure',) -l[:] = [Mapping({"abc" : FailingIterNext()})]:NotImplementedError:() +>>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})] +l[:] = [Mapping({"abcG" : FailingIter()})]:TypeError:('unable to convert FailingIter to vim structure',) +l[:] = [Mapping({"abcG" : FailingIterNext()})]:NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : None})]:TypeError:('unable to convert NoneType to vim structure',) -l[:] = [Mapping({"abc" : {"": 1}})]:ValueError:('empty keys are not allowed',) -l[:] = [Mapping({"abc" : {u"": 1}})]:ValueError:('empty keys are not allowed',) -l[:] = [Mapping({"abc" : FailingMapping()})]:NotImplementedError:() -l[:] = [Mapping({"abc" : FailingMappingKey()})]:NotImplementedError:() +>>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})] +l[:] = [Mapping({"abcG" : None})]:TypeError:('unable to convert NoneType to vim structure',) +l[:] = [Mapping({"abcG" : {"": 1}})]:ValueError:('empty keys are not allowed',) +l[:] = [Mapping({"abcG" : {u"": 1}})]:ValueError:('empty keys are not allowed',) +l[:] = [Mapping({"abcG" : FailingMapping()})]:NotImplementedError:() +l[:] = [Mapping({"abcG" : FailingMappingKey()})]:NotImplementedError:() <<< Finished >>> Testing *Iter* using l[:] = [%s] l[:] = [FailingIter()]:TypeError:('unable to convert FailingIter to vim structure',) @@ -827,52 +830,52 @@ l.extend([{1 : 1}]):TypeError:('expected str() or unicode() instance, but got in l.extend([{u"\0" : 1}]):TypeError:('expected string without null bytes',) l.extend([{"\0" : 1}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}]) -l.extend([{"abc" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) -l.extend([{"abc" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) -l.extend([{"abc" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l.extend([{"abcF" : {%s : 1}}]) +l.extend([{"abcF" : {1 : 1}}]):TypeError:('expected str() or unicode() instance, but got int',) +l.extend([{"abcF" : {u"\0" : 1}}]):TypeError:('expected string without null bytes',) +l.extend([{"abcF" : {"\0" : 1}}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}]) -l.extend([{"abc" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) -l.extend([{"abc" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) -l.extend([{"abc" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l.extend([{"abcF" : Mapping({%s : 1})}]) +l.extend([{"abcF" : Mapping({1 : 1})}]):TypeError:('expected str() or unicode() instance, but got int',) +l.extend([{"abcF" : Mapping({u"\0" : 1})}]):TypeError:('expected string without null bytes',) +l.extend([{"abcF" : Mapping({"\0" : 1})}]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using l.extend([{"abc" : %s}]) -l.extend([{"abc" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) -l.extend([{"abc" : FailingIterNext()}]):NotImplementedError:() +>>> Testing *Iter* using l.extend([{"abcF" : %s}]) +l.extend([{"abcF" : FailingIter()}]):TypeError:('unable to convert FailingIter to vim structure',) +l.extend([{"abcF" : FailingIterNext()}]):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using l.extend([{"abc" : %s}]) -l.extend([{"abc" : None}]):TypeError:('unable to convert NoneType to vim structure',) -l.extend([{"abc" : {"": 1}}]):ValueError:('empty keys are not allowed',) -l.extend([{"abc" : {u"": 1}}]):ValueError:('empty keys are not allowed',) -l.extend([{"abc" : FailingMapping()}]):NotImplementedError:() -l.extend([{"abc" : FailingMappingKey()}]):NotImplementedError:() +>>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}]) +l.extend([{"abcF" : None}]):TypeError:('unable to convert NoneType to vim structure',) +l.extend([{"abcF" : {"": 1}}]):ValueError:('empty keys are not allowed',) +l.extend([{"abcF" : {u"": 1}}]):ValueError:('empty keys are not allowed',) +l.extend([{"abcF" : FailingMapping()}]):NotImplementedError:() +l.extend([{"abcF" : FailingMappingKey()}]):NotImplementedError:() <<< Finished >>> Testing StringToChars using l.extend([Mapping({%s : 1})]) l.extend([Mapping({1 : 1})]):TypeError:('expected str() or unicode() instance, but got int',) l.extend([Mapping({u"\0" : 1})]):TypeError:('expected string without null bytes',) l.extend([Mapping({"\0" : 1})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})]) -l.extend([Mapping({"abc" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) -l.extend([Mapping({"abc" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) -l.extend([Mapping({"abc" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l.extend([Mapping({"abcG" : {%s : 1}})]) +l.extend([Mapping({"abcG" : {1 : 1}})]):TypeError:('expected str() or unicode() instance, but got int',) +l.extend([Mapping({"abcG" : {u"\0" : 1}})]):TypeError:('expected string without null bytes',) +l.extend([Mapping({"abcG" : {"\0" : 1}})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})]) -l.extend([Mapping({"abc" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) -l.extend([Mapping({"abc" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) -l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using l.extend([Mapping({"abcG" : Mapping({%s : 1})})]) +l.extend([Mapping({"abcG" : Mapping({1 : 1})})]):TypeError:('expected str() or unicode() instance, but got int',) +l.extend([Mapping({"abcG" : Mapping({u"\0" : 1})})]):TypeError:('expected string without null bytes',) +l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) -l.extend([Mapping({"abc" : FailingIterNext()})]):NotImplementedError:() +>>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})]) +l.extend([Mapping({"abcG" : FailingIter()})]):TypeError:('unable to convert FailingIter to vim structure',) +l.extend([Mapping({"abcG" : FailingIterNext()})]):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : None})]):TypeError:('unable to convert NoneType to vim structure',) -l.extend([Mapping({"abc" : {"": 1}})]):ValueError:('empty keys are not allowed',) -l.extend([Mapping({"abc" : {u"": 1}})]):ValueError:('empty keys are not allowed',) -l.extend([Mapping({"abc" : FailingMapping()})]):NotImplementedError:() -l.extend([Mapping({"abc" : FailingMappingKey()})]):NotImplementedError:() +>>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})]) +l.extend([Mapping({"abcG" : None})]):TypeError:('unable to convert NoneType to vim structure',) +l.extend([Mapping({"abcG" : {"": 1}})]):ValueError:('empty keys are not allowed',) +l.extend([Mapping({"abcG" : {u"": 1}})]):ValueError:('empty keys are not allowed',) +l.extend([Mapping({"abcG" : FailingMapping()})]):NotImplementedError:() +l.extend([Mapping({"abcG" : FailingMappingKey()})]):NotImplementedError:() <<< Finished >>> Testing *Iter* using l.extend([%s]) l.extend([FailingIter()]):TypeError:('unable to convert FailingIter to vim structure',) @@ -900,52 +903,52 @@ f({1 : 1}):TypeError:('expected str() or unicode() instance, but got int',) f({u"\0" : 1}):TypeError:('expected string without null bytes',) f({"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using f({"abc" : {%s : 1}}) -f({"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) -f({"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) -f({"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using f({"abcF" : {%s : 1}}) +f({"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) +f({"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) +f({"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using f({"abc" : Mapping({%s : 1})}) -f({"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) -f({"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) -f({"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using f({"abcF" : Mapping({%s : 1})}) +f({"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) +f({"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) +f({"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using f({"abc" : %s}) -f({"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) -f({"abc" : FailingIterNext()}):NotImplementedError:() +>>> Testing *Iter* using f({"abcF" : %s}) +f({"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) +f({"abcF" : FailingIterNext()}):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using f({"abc" : %s}) -f({"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) -f({"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) -f({"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) -f({"abc" : FailingMapping()}):NotImplementedError:() -f({"abc" : FailingMappingKey()}):NotImplementedError:() +>>> Testing ConvertFromPyObject using f({"abcF" : %s}) +f({"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +f({"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) +f({"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) +f({"abcF" : FailingMapping()}):NotImplementedError:() +f({"abcF" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using f(Mapping({%s : 1})) f(Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) f(Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) f(Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}})) -f(Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) -f(Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) -f(Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using f(Mapping({"abcG" : {%s : 1}})) +f(Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) +f(Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) +f(Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})})) -f(Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) -f(Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) -f(Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using f(Mapping({"abcG" : Mapping({%s : 1})})) +f(Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) +f(Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) +f(Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) -f(Mapping({"abc" : FailingIterNext()})):NotImplementedError:() +>>> Testing *Iter* using f(Mapping({"abcG" : %s})) +f(Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) +f(Mapping({"abcG" : FailingIterNext()})):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) -f(Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) -f(Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) -f(Mapping({"abc" : FailingMapping()})):NotImplementedError:() -f(Mapping({"abc" : FailingMappingKey()})):NotImplementedError:() +>>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s})) +f(Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +f(Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) +f(Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) +f(Mapping({"abcG" : FailingMapping()})):NotImplementedError:() +f(Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:() <<< Finished >>> Testing *Iter* using f(%s) f(FailingIter()):TypeError:('unable to convert FailingIter to vim structure',) @@ -963,52 +966,52 @@ fd(self={1 : 1}):TypeError:('expected str() or unicode() instance, but got int', fd(self={u"\0" : 1}):TypeError:('expected string without null bytes',) fd(self={"\0" : 1}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using fd(self={"abc" : {%s : 1}}) -fd(self={"abc" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) -fd(self={"abc" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) -fd(self={"abc" : {"\0" : 1}}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using fd(self={"abcF" : {%s : 1}}) +fd(self={"abcF" : {1 : 1}}):TypeError:('expected str() or unicode() instance, but got int',) +fd(self={"abcF" : {u"\0" : 1}}):TypeError:('expected string without null bytes',) +fd(self={"abcF" : {"\0" : 1}}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})}) -fd(self={"abc" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) -fd(self={"abc" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) -fd(self={"abc" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using fd(self={"abcF" : Mapping({%s : 1})}) +fd(self={"abcF" : Mapping({1 : 1})}):TypeError:('expected str() or unicode() instance, but got int',) +fd(self={"abcF" : Mapping({u"\0" : 1})}):TypeError:('expected string without null bytes',) +fd(self={"abcF" : Mapping({"\0" : 1})}):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using fd(self={"abc" : %s}) -fd(self={"abc" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) -fd(self={"abc" : FailingIterNext()}):NotImplementedError:() +>>> Testing *Iter* using fd(self={"abcF" : %s}) +fd(self={"abcF" : FailingIter()}):TypeError:('unable to convert FailingIter to vim structure',) +fd(self={"abcF" : FailingIterNext()}):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using fd(self={"abc" : %s}) -fd(self={"abc" : None}):TypeError:('unable to convert NoneType to vim structure',) -fd(self={"abc" : {"": 1}}):ValueError:('empty keys are not allowed',) -fd(self={"abc" : {u"": 1}}):ValueError:('empty keys are not allowed',) -fd(self={"abc" : FailingMapping()}):NotImplementedError:() -fd(self={"abc" : FailingMappingKey()}):NotImplementedError:() +>>> Testing ConvertFromPyObject using fd(self={"abcF" : %s}) +fd(self={"abcF" : None}):TypeError:('unable to convert NoneType to vim structure',) +fd(self={"abcF" : {"": 1}}):ValueError:('empty keys are not allowed',) +fd(self={"abcF" : {u"": 1}}):ValueError:('empty keys are not allowed',) +fd(self={"abcF" : FailingMapping()}):NotImplementedError:() +fd(self={"abcF" : FailingMappingKey()}):NotImplementedError:() <<< Finished >>> Testing StringToChars using fd(self=Mapping({%s : 1})) fd(self=Mapping({1 : 1})):TypeError:('expected str() or unicode() instance, but got int',) fd(self=Mapping({u"\0" : 1})):TypeError:('expected string without null bytes',) fd(self=Mapping({"\0" : 1})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}})) -fd(self=Mapping({"abc" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) -fd(self=Mapping({"abc" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) -fd(self=Mapping({"abc" : {"\0" : 1}})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using fd(self=Mapping({"abcG" : {%s : 1}})) +fd(self=Mapping({"abcG" : {1 : 1}})):TypeError:('expected str() or unicode() instance, but got int',) +fd(self=Mapping({"abcG" : {u"\0" : 1}})):TypeError:('expected string without null bytes',) +fd(self=Mapping({"abcG" : {"\0" : 1}})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})})) -fd(self=Mapping({"abc" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) -fd(self=Mapping({"abc" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) -fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) +>>> Testing StringToChars using fd(self=Mapping({"abcG" : Mapping({%s : 1})})) +fd(self=Mapping({"abcG" : Mapping({1 : 1})})):TypeError:('expected str() or unicode() instance, but got int',) +fd(self=Mapping({"abcG" : Mapping({u"\0" : 1})})):TypeError:('expected string without null bytes',) +fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):TypeError:('expected string without null bytes',) <<< Finished ->>> Testing *Iter* using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) -fd(self=Mapping({"abc" : FailingIterNext()})):NotImplementedError:() +>>> Testing *Iter* using fd(self=Mapping({"abcG" : %s})) +fd(self=Mapping({"abcG" : FailingIter()})):TypeError:('unable to convert FailingIter to vim structure',) +fd(self=Mapping({"abcG" : FailingIterNext()})):NotImplementedError:() <<< Finished ->>> Testing ConvertFromPyObject using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : None})):TypeError:('unable to convert NoneType to vim structure',) -fd(self=Mapping({"abc" : {"": 1}})):ValueError:('empty keys are not allowed',) -fd(self=Mapping({"abc" : {u"": 1}})):ValueError:('empty keys are not allowed',) -fd(self=Mapping({"abc" : FailingMapping()})):NotImplementedError:() -fd(self=Mapping({"abc" : FailingMappingKey()})):NotImplementedError:() +>>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s})) +fd(self=Mapping({"abcG" : None})):TypeError:('unable to convert NoneType to vim structure',) +fd(self=Mapping({"abcG" : {"": 1}})):ValueError:('empty keys are not allowed',) +fd(self=Mapping({"abcG" : {u"": 1}})):ValueError:('empty keys are not allowed',) +fd(self=Mapping({"abcG" : FailingMapping()})):NotImplementedError:() +fd(self=Mapping({"abcG" : FailingMappingKey()})):NotImplementedError:() <<< Finished >>> Testing *Iter* using fd(self=%s) fd(self=FailingIter()):TypeError:('unable to convert FailingIter to vim dictionary',) @@ -1037,8 +1040,8 @@ vim.current.window.xxx:AttributeError:('xxx',) vim.current.window.buffer = 0:TypeError:('readonly attribute: buffer',) vim.current.window.cursor = (100000000, 100000000):error:('cursor position outside buffer',) vim.current.window.cursor = True:TypeError:('argument must be 2-item sequence, not bool',) -vim.current.window.height = "abc":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) -vim.current.window.width = "abc":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) +vim.current.window.height = "abcK":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) +vim.current.window.width = "abcL":TypeError:('expected int(), long() or something supporting coercing to long(), but got str',) vim.current.window.xxxxxx = True:AttributeError:('xxxxxx',) > WinList >> WinListItem @@ -1048,7 +1051,7 @@ vim.windows[1000]:IndexError:('no such window',) vim.current.buffer[0] = "\na":error:('string cannot contain newlines',) >> SetBufferLine (indirect) vim.current.buffer[0] = True:TypeError:('bad argument type for built-in operation',) ->> SetBufferLines (indirect) +>> SetBufferLineList (indirect) vim.current.buffer[:] = True:TypeError:('bad argument type for built-in operation',) vim.current.buffer[:] = ["\na", "bc"]:error:('string cannot contain newlines',) >> InsertBufferLines (indirect) @@ -1066,7 +1069,7 @@ vim.current.buffer.name = True:TypeError:('expected str() or unicode() instance, vim.current.buffer.xxx = True:AttributeError:('xxx',) >> BufferMark vim.current.buffer.mark(0):TypeError:('expected str() or unicode() instance, but got int',) -vim.current.buffer.mark("abc"):ValueError:('mark name must be a single character',) +vim.current.buffer.mark("abcM"):ValueError:('mark name must be a single character',) vim.current.buffer.mark("!"):error:('invalid mark name',) >> BufferRange vim.current.buffer.range(1, 2, 3):TypeError:('function takes exactly 2 arguments (3 given)',) @@ -1086,7 +1089,7 @@ vim.current.xxx = True:AttributeError:('xxx',) 2,xx before after -vim.command("throw 'abc'"):error:('abc',) +vim.command("throw 'abcN'"):error:('abcN',) Exe("throw 'def'"):error:('def',) vim.eval("Exe('throw ''ghi''')"):error:('ghi',) vim.eval("Exe('echoerr ''jkl''')"):error:('Vim(echoerr):jkl',) diff --git a/src/testdir/test87.in b/src/testdir/test87.in index 1223ca96aa..6b89117beb 100644 --- a/src/testdir/test87.in +++ b/src/testdir/test87.in @@ -5,8 +5,8 @@ STARTTEST :set noswapfile :if !has('python3') | e! test.ok | wq! test.out | endif :lang C -:py3 import vim :fun Test() +:py3 import vim :let l = [] :py3 l=vim.bindeval('l') :py3 f=vim.bindeval('function("strlen")') @@ -51,6 +51,9 @@ EOF : $put =string(key) . ' : ' . string(Val) : unlet key Val :endfor +:py3 del dk +:py3 del di +:py3 del dv :" :" removing items with del :py3 del l[2] @@ -169,12 +172,12 @@ EOF :unlockvar! l :" :" Function calls -:function New(...) -:return ['NewStart']+a:000+['NewEnd'] -:endfunction -:function DictNew(...) dict -:return ['DictNewStart']+a:000+['DictNewEnd', self] -:endfunction +:fun New(...) +: return ['NewStart']+a:000+['NewEnd'] +:endfun +:fun DictNew(...) dict +: return ['DictNewStart']+a:000+['DictNewEnd', self] +:endfun :let l=[function('New'), function('DictNew')] :py3 l=vim.bindeval('l') :py3 l.extend(list(l[0](1, 2, 3))) @@ -204,7 +207,8 @@ EOF : $put ='[0.0, 0.0]' :endif :let messages=[] -:py3 < 8 # check if the background thread is working +:py3 del time +:py3 del threading :$put =string(l) :" :" settrace @@ -326,12 +335,14 @@ def trace_main(): EOF :py3 sys.settrace(traceit) :py3 trace_main() +:py3 del traceit +:py3 del trace_main :py3 sys.settrace(None) :$put =string(l) :" :" Vars :let g:foo = 'bac' -:let w:abc = 'def' +:let w:abc3 = 'def' :let b:baz = 'bar' :let t:bar = 'jkl' :try @@ -340,7 +351,7 @@ EOF : put =py3eval('vim.vvars[''exception'']') :endtry :put =py3eval('vim.vars[''foo'']') -:put =py3eval('vim.current.window.vars[''abc'']') +:put =py3eval('vim.current.window.vars[''abc3'']') :put =py3eval('vim.current.buffer.vars[''baz'']') :put =py3eval('vim.current.tabpage.vars[''bar'']') :" @@ -388,16 +399,16 @@ def ev(s, g=globals(), l=locals()): vim.command('let exc=' + repr(e.__class__.__name__)) return 0 EOF -:function E(s) +:fun E(s) : python3 e(vim.eval('a:s')) -:endfunction -:function Ev(s) +:endfun +:fun Ev(s) : let r=py3eval('ev(vim.eval("a:s"))') : if exists('exc') : throw exc : endif : return r -:endfunction +:endfun :py3 gopts1=vim.options :py3 wopts1=vim.windows[2].options :py3 wopts2=vim.windows[0].options @@ -412,7 +423,7 @@ EOF :let lst+=[['operatorfunc', 'A', 'B', 'C', 2, 0, 1, 0 ]] :let lst+=[['number', 0, 1, 1, 0, 1, 0, 1 ]] :let lst+=[['numberwidth', 2, 3, 5, -100, 0, 0, 1 ]] -:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc', 0, 0, 1 ]] +:let lst+=[['colorcolumn', '+1', '+2', '+3', 'abc4', 0, 0, 1 ]] :let lst+=[['statusline', '1', '2', '4', 0, 0, 1, 1 ]] :let lst+=[['autoindent', 0, 1, 1, 2, 1, 0, 2 ]] :let lst+=[['shiftwidth', 0, 2, 1, 3, 0, 0, 2 ]] @@ -462,10 +473,27 @@ EOF : endfor : call RecVars(oname) :endfor +:delfunction RecVars +:delfunction E +:delfunction Ev +:py3 del ev +:py3 del e :only :for buf in g:bufs[1:] : execute 'bwipeout!' buf :endfor +:py3 del gopts1 +:py3 del wopts1 +:py3 del wopts2 +:py3 del wopts3 +:py3 del bopts1 +:py3 del bopts2 +:py3 del bopts3 +:py3 del oval1 +:py3 del oval2 +:py3 del oval3 +:py3 del oname +:py3 del invval :" :" Test buffer object :vnew @@ -485,7 +513,7 @@ cb = vim.current.buffer # Tests BufferAppend and BufferItem cb.append(b[0]) # Tests BufferSlice and BufferAssSlice -cb.append('abc') # Will be overwritten +cb.append('abc5') # Will be overwritten cb[-1:] = b[:-2] # Test BufferLength and BufferAssSlice cb.append('def') # Will not be overwritten @@ -509,13 +537,14 @@ b.name = 'bar' cb.append(b.name[-11:].replace(os.path.sep, '/')) cb.name = old_name cb.append(cb.name[-17:].replace(os.path.sep, '/')) +del old_name # Test CheckBuffer for _b in vim.buffers: if _b is not cb: vim.command('bwipeout! ' + str(_b.number)) del _b cb.append('valid: b:%s, cb:%s' % (repr(b.valid), repr(cb.valid))) -for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'): +for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc6")'): try: exec(expr) except vim.error: @@ -525,6 +554,7 @@ for expr in ('b[1]','b[:] = ["A", "B"]','b[:]','b.append("abc")'): # Should not happen in any case cb.append('No exception for ' + expr) vim.command('cd .') +del b EOF :" :" Test vim.buffers object @@ -558,6 +588,7 @@ for b in vim.buffers: # Check indexing: vim.buffers[number].number == number cb.append(str(b.number) + ':' + repr(vim.buffers[b.number]) + '=' + repr(b)) prevnum = b.number +del prevnum cb.append(str(len(vim.buffers))) @@ -581,6 +612,8 @@ try: next(i4) except StopIteration: cb.append('StopIteration') +del i4 +del bnums EOF :" :" Test vim.{tabpage,window}list and vim.{tabpage,window} objects @@ -622,7 +655,11 @@ for t in vim.tabpages: raise ValueError except Exception as e: cb.append('!!!!!! Error while getting attribute ' + attr + ': ' + e.__class__.__name__) + del aval + del attr w.cursor = (len(w.buffer), 0) +del W +del Cursor cb.append('Number of windows in current tab page: ' + str(len(vim.windows))) if list(vim.windows) != list(vim.current.tabpage.windows): cb.append('!!!!!! Windows differ') @@ -635,6 +672,7 @@ def H(o): cb.append('Current tab page: ' + repr(vim.current.tabpage)) cb.append('Current window: ' + repr(vim.current.window) + ': ' + H(vim.current.window) + ' is ' + H(vim.current.tabpage.window)) cb.append('Current buffer: ' + repr(vim.current.buffer) + ': ' + H(vim.current.buffer) + ' is ' + H(vim.current.window.buffer)+ ' is ' + H(vim.current.tabpage.window.buffer)) +del H # Assigning: fails try: vim.current.window = vim.tabpages[0].window @@ -646,6 +684,7 @@ for attr in ('window', 'tabpage', 'buffer'): setattr(vim.current, attr, None) except TypeError: cb.append('Type error at assigning None to vim.current.' + attr) +del attr # Assigning: success vim.current.tabpage = vim.tabpages[-2] @@ -661,8 +700,13 @@ ts = list(vim.tabpages) for b in vim.buffers: if b is not cb: vim.command('bwipeout! ' + str(b.number)) +del b cb.append('w.valid: ' + repr([w.valid for w in ws])) cb.append('t.valid: ' + repr([t.valid for t in ts])) +del w +del t +del ts +del ws EOF :tabonly! :only! @@ -681,6 +725,8 @@ for expr, attr in ( ('vim.current.tabpage', 'TabPage'), ): cb.append(expr + ':' + attr + ':' + repr(type(eval(expr)) is getattr(vim, attr))) +del expr +del attr EOF :" :" Test __dir__() method @@ -706,15 +752,15 @@ EOF :$put =string(py3eval('vim.Dictionary(a=1)')) :$put =string(py3eval('vim.Dictionary(((''a'', 1),))')) :$put =string(py3eval('vim.List()')) -:$put =string(py3eval('vim.List(iter(''abc''))')) +:$put =string(py3eval('vim.List(iter(''abc7''))')) :$put =string(py3eval('vim.Function(''tr'')')) :" :" Test stdout/stderr :redir => messages -:py3 sys.stdout.write('abc') ; sys.stdout.write('def') -:py3 sys.stderr.write('abc') ; sys.stderr.write('def') -:py3 sys.stdout.writelines(iter('abc')) -:py3 sys.stderr.writelines(iter('abc')) +:py3 sys.stdout.write('abc8') ; sys.stdout.write('def') +:py3 sys.stderr.write('abc9') ; sys.stderr.write('def') +:py3 sys.stdout.writelines(iter('abcA')) +:py3 sys.stderr.writelines(iter('abcB')) :redir END :$put =string(substitute(messages, '\d\+', '', 'g')) :" Test subclassing @@ -735,7 +781,7 @@ class DupList(vim.List): return [super(DupList, self).__getitem__(idx)] * 2 dl = DupList() -dl2 = DupList(iter('abc')) +dl2 = DupList(iter('abcC')) dl.extend(dl2[0]) class DupFun(vim.Function): @@ -748,6 +794,19 @@ EOF :$put =string(py3eval('dl')) :$put =string(py3eval('dl2')) :$put =string(py3eval('df(2)')) +:$put =string(py3eval('dl') is# py3eval('dl')) +:$put =string(py3eval('dd') is# py3eval('dd')) +:$put =string(py3eval('df')) +:delfunction Put +py3 << EOF +del DupDict +del DupList +del DupFun +del dd +del dl +del dl2 +del df +EOF :" :" Test chdir py3 << EOF @@ -761,6 +820,7 @@ cb.append(vim.eval('@%').replace(os.path.sep, '/')) os.chdir('testdir') cb.append(str(fnamemodify('.', ':p:h:t'))) cb.append(vim.eval('@%')) +del fnamemodify EOF :" :" Test errors @@ -784,11 +844,11 @@ def ee(expr, g=globals(), l=locals()): cb.append(expr + '::' + repr((e.__class__, e))) d = vim.Dictionary() -ned = vim.Dictionary(foo='bar', baz='abc') +ned = vim.Dictionary(foo='bar', baz='abcD') dl = vim.Dictionary(a=1) dl.locked = True l = vim.List() -ll = vim.List('abc') +ll = vim.List('abcE') ll.locked = True f = vim.Function('string') fd = vim.Function('F') @@ -825,11 +885,11 @@ def convertfrompyobject_test(expr, recurse=True): # pydict_to_tv stringtochars_test(expr % '{%s : 1}') if recurse: - convertfrompyobject_test(expr % '{"abc" : %s}', False) + convertfrompyobject_test(expr % '{"abcF" : %s}', False) # pymap_to_tv stringtochars_test(expr % 'Mapping({%s : 1})') if recurse: - convertfrompyobject_test(expr % 'Mapping({"abc" : %s})', False) + convertfrompyobject_test(expr % 'Mapping({"abcG" : %s})', False) # pyseq_to_tv iter_test(expr) return subexpr_test(expr, 'ConvertFromPyObject', ( @@ -872,7 +932,7 @@ class FailingMappingKey(object): raise NotImplementedError def keys(self): - return list("abc") + return list("abcH") class FailingMapping(object): def __getitem__(self): @@ -914,7 +974,7 @@ cb.append("> VimStrwidth") ee('vim.strwidth(1)') cb.append("> Dictionary") cb.append(">> DictionaryConstructor") -ee('vim.Dictionary("abc")') +ee('vim.Dictionary("abcI")') ##! Not checked: py_dict_alloc failure cb.append(">> DictionarySetattr") ee('del d.locked') @@ -929,6 +989,7 @@ ee('d.pop("a")') ee('dl.pop("a")') cb.append(">> DictionaryIterNext") ee('for i in ned: ned["a"] = 1') +del i cb.append(">> DictionaryAssItem") ee('dl["b"] = 1') stringtochars_test('d[%s] = 1') @@ -958,7 +1019,7 @@ cb.append(">> ListAssItem") ee('ll[1] = 2') ee('l[1000] = 3') cb.append(">> ListAssSlice") -ee('ll[1:100] = "abc"') +ee('ll[1:100] = "abcJ"') iter_test('l[:] = %s') convertfrompyobject_test('l[:] = [%s]') cb.append(">> ListConcatInPlace") @@ -989,8 +1050,8 @@ cb.append(">> WindowSetattr") ee('vim.current.window.buffer = 0') ee('vim.current.window.cursor = (100000000, 100000000)') ee('vim.current.window.cursor = True') -ee('vim.current.window.height = "abc"') -ee('vim.current.window.width = "abc"') +ee('vim.current.window.height = "abcK"') +ee('vim.current.window.width = "abcL"') ee('vim.current.window.xxxxxx = True') cb.append("> WinList") cb.append(">> WinListItem") @@ -1000,7 +1061,7 @@ cb.append(">> StringToLine (indirect)") ee('vim.current.buffer[0] = "\\na"') cb.append(">> SetBufferLine (indirect)") ee('vim.current.buffer[0] = True') -cb.append(">> SetBufferLines (indirect)") +cb.append(">> SetBufferLineList (indirect)") ee('vim.current.buffer[:] = True') ee('vim.current.buffer[:] = ["\\na", "bc"]') cb.append(">> InsertBufferLines (indirect)") @@ -1018,7 +1079,7 @@ ee('vim.current.buffer.name = True') ee('vim.current.buffer.xxx = True') cb.append(">> BufferMark") ee('vim.current.buffer.mark(0)') -ee('vim.current.buffer.mark("abc")') +ee('vim.current.buffer.mark("abcM")') ee('vim.current.buffer.mark("!")') cb.append(">> BufferRange") ee('vim.current.buffer.range(1, 2, 3)') @@ -1035,7 +1096,28 @@ ee('vim.current.buffer = True') ee('vim.current.window = True') ee('vim.current.tabpage = True') ee('vim.current.xxx = True') +del d +del ned +del dl +del l +del ll +del f +del fd +del fdel +del subexpr_test +del stringtochars_test +del Mapping +del convertfrompyobject_test +del convertfrompymapping_test +del iter_test +del FailingTrue +del FailingIter +del FailingIterNext +del FailingMapping +del FailingMappingKey +del FailingList EOF +:delfunction F :" :" Test import py3 << EOF @@ -1049,6 +1131,10 @@ import before cb.append(before.dir) import after cb.append(after.dir) +del before +del after +del d +del ddir EOF :" :" Test exceptions @@ -1057,18 +1143,48 @@ EOF :endfun py3 << EOF Exe = vim.bindeval('function("Exe")') -ee('vim.command("throw \'abc\'")') +ee('vim.command("throw \'abcN\'")') ee('Exe("throw \'def\'")') ee('vim.eval("Exe(\'throw \'\'ghi\'\'\')")') ee('vim.eval("Exe(\'echoerr \'\'jkl\'\'\')")') ee('vim.eval("Exe(\'xxx_non_existent_command_xxx\')")') ee('vim.bindeval("Exe(\'xxx_non_existent_command_xxx\')")') +del Exe +EOF +:delfunction Exe +:" +:" Cleanup +py3 << EOF +del cb +del ee +del sys +del os +del vim EOF :endfun :" -:call Test() +:fun RunTest() +:let checkrefs = !empty($PYTHONDUMPREFS) +:let start = getline(1, '$') +:for i in range(checkrefs ? 10 : 1) +: if i != 0 +: %d _ +: call setline(1, start) +: endif +: call Test() +: if i == 0 +: let result = getline(1, '$') +: endif +:endfor +:if checkrefs +: %d _ +: call setline(1, result) +:endif +:endfun :" -:delfunc Test +:call RunTest() +:delfunction RunTest +:delfunction Test :call garbagecollect(1) :" :/^start:/,$wq! test.out diff --git a/src/testdir/test87.ok b/src/testdir/test87.ok index b975eccb44..78b23074ae 100644 --- a/src/testdir/test87.ok +++ b/src/testdir/test87.ok @@ -68,7 +68,7 @@ d : locked:0;scope:0 dl : locked:1;scope:0 v: : locked:2;scope:1 g: : locked:0;scope:2 -d:{'abc': 1} +d:{'abc2': 1} dl:{'def': 1} l : locked:0 ll : locked:1 @@ -191,12 +191,12 @@ jkl B: 1:3 2:5 3:2 4:8 >>> colorcolumn p/gopts1! KeyError - inv: 'abc'! KeyError + inv: 'abc4'! KeyError gopts1! KeyError p/wopts1: b'' - inv: 'abc'! error + inv: 'abc4'! error p/bopts1! KeyError - inv: 'abc'! KeyError + inv: 'abc4'! KeyError bopts1! KeyError bopts2! KeyError bopts3! KeyError @@ -404,20 +404,23 @@ output:__dir__,flush,softspace,write,writelines {'a': 1} {'a': 1} [] -['a', 'b', 'c'] +['a', 'b', 'c', '7'] function('tr') ' abcdef line : abcdef -abc +abcA line : -abc' +abcB' ['a', 'dup_a'] ['a', 'a'] -['a', 'b', 'c'] +['a', 'b', 'c', 'C'] [2, 2] [2, 2] +1 +1 +function('Put') b'testdir' test87.in b'src' @@ -449,7 +452,7 @@ vim.bindeval(1):(, TypeError('expected bytes() or str() insta vim.strwidth(1):(, TypeError('expected bytes() or str() instance, but got int',)) > Dictionary >> DictionaryConstructor -vim.Dictionary("abc"):(, ValueError('expected sequence element of size 2, but got sequence of size 1',)) +vim.Dictionary("abcI"):(, ValueError('expected sequence element of size 2, but got sequence of size 1',)) >> DictionarySetattr del d.locked:(, AttributeError('cannot delete vim.Dictionary attributes',)) d.locked = FailingTrue():(, NotImplementedError()) @@ -479,52 +482,52 @@ d["a"] = {1 : 1}:(, TypeError('expected bytes() or str() inst d["a"] = {b"\0" : 1}:(, TypeError('expected bytes with no null',)) d["a"] = {"\0" : 1}:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d["a"] = {"abc" : {%s : 1}} -d["a"] = {"abc" : {1 : 1}}:(, TypeError('expected bytes() or str() instance, but got int',)) -d["a"] = {"abc" : {b"\0" : 1}}:(, TypeError('expected bytes with no null',)) -d["a"] = {"abc" : {"\0" : 1}}:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d["a"] = {"abcF" : {%s : 1}} +d["a"] = {"abcF" : {1 : 1}}:(, TypeError('expected bytes() or str() instance, but got int',)) +d["a"] = {"abcF" : {b"\0" : 1}}:(, TypeError('expected bytes with no null',)) +d["a"] = {"abcF" : {"\0" : 1}}:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d["a"] = {"abc" : Mapping({%s : 1})} -d["a"] = {"abc" : Mapping({1 : 1})}:(, TypeError('expected bytes() or str() instance, but got int',)) -d["a"] = {"abc" : Mapping({b"\0" : 1})}:(, TypeError('expected bytes with no null',)) -d["a"] = {"abc" : Mapping({"\0" : 1})}:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d["a"] = {"abcF" : Mapping({%s : 1})} +d["a"] = {"abcF" : Mapping({1 : 1})}:(, TypeError('expected bytes() or str() instance, but got int',)) +d["a"] = {"abcF" : Mapping({b"\0" : 1})}:(, TypeError('expected bytes with no null',)) +d["a"] = {"abcF" : Mapping({"\0" : 1})}:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d["a"] = {"abc" : %s} -d["a"] = {"abc" : FailingIter()}:(, TypeError('unable to convert FailingIter to vim structure',)) -d["a"] = {"abc" : FailingIterNext()}:(, NotImplementedError()) +>>> Testing *Iter* using d["a"] = {"abcF" : %s} +d["a"] = {"abcF" : FailingIter()}:(, TypeError('unable to convert FailingIter to vim structure',)) +d["a"] = {"abcF" : FailingIterNext()}:(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d["a"] = {"abc" : %s} -d["a"] = {"abc" : None}:(, TypeError('unable to convert NoneType to vim structure',)) -d["a"] = {"abc" : {b"": 1}}:(, ValueError('empty keys are not allowed',)) -d["a"] = {"abc" : {"": 1}}:(, ValueError('empty keys are not allowed',)) -d["a"] = {"abc" : FailingMapping()}:(, NotImplementedError()) -d["a"] = {"abc" : FailingMappingKey()}:(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d["a"] = {"abcF" : %s} +d["a"] = {"abcF" : None}:(, TypeError('unable to convert NoneType to vim structure',)) +d["a"] = {"abcF" : {b"": 1}}:(, ValueError('empty keys are not allowed',)) +d["a"] = {"abcF" : {"": 1}}:(, ValueError('empty keys are not allowed',)) +d["a"] = {"abcF" : FailingMapping()}:(, NotImplementedError()) +d["a"] = {"abcF" : FailingMappingKey()}:(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d["a"] = Mapping({%s : 1}) d["a"] = Mapping({1 : 1}):(, TypeError('expected bytes() or str() instance, but got int',)) d["a"] = Mapping({b"\0" : 1}):(, TypeError('expected bytes with no null',)) d["a"] = Mapping({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d["a"] = Mapping({"abc" : {%s : 1}}) -d["a"] = Mapping({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) -d["a"] = Mapping({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) -d["a"] = Mapping({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d["a"] = Mapping({"abcG" : {%s : 1}}) +d["a"] = Mapping({"abcG" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) +d["a"] = Mapping({"abcG" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) +d["a"] = Mapping({"abcG" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d["a"] = Mapping({"abc" : Mapping({%s : 1})}) -d["a"] = Mapping({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) -d["a"] = Mapping({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) -d["a"] = Mapping({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d["a"] = Mapping({"abcG" : Mapping({%s : 1})}) +d["a"] = Mapping({"abcG" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) +d["a"] = Mapping({"abcG" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) +d["a"] = Mapping({"abcG" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) -d["a"] = Mapping({"abc" : FailingIterNext()}):(, NotImplementedError()) +>>> Testing *Iter* using d["a"] = Mapping({"abcG" : %s}) +d["a"] = Mapping({"abcG" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) +d["a"] = Mapping({"abcG" : FailingIterNext()}):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d["a"] = Mapping({"abc" : %s}) -d["a"] = Mapping({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) -d["a"] = Mapping({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) -d["a"] = Mapping({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) -d["a"] = Mapping({"abc" : FailingMapping()}):(, NotImplementedError()) -d["a"] = Mapping({"abc" : FailingMappingKey()}):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d["a"] = Mapping({"abcG" : %s}) +d["a"] = Mapping({"abcG" : None}):(, TypeError('unable to convert NoneType to vim structure',)) +d["a"] = Mapping({"abcG" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) +d["a"] = Mapping({"abcG" : {"": 1}}):(, ValueError('empty keys are not allowed',)) +d["a"] = Mapping({"abcG" : FailingMapping()}):(, NotImplementedError()) +d["a"] = Mapping({"abcG" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using d["a"] = %s d["a"] = FailingIter():(, TypeError('unable to convert FailingIter to vim structure',)) @@ -551,52 +554,52 @@ d.update({1 : 1}):(, TypeError('expected bytes() or str() ins d.update({b"\0" : 1}):(, TypeError('expected bytes with no null',)) d.update({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update({"abc" : {%s : 1}}) -d.update({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) -d.update({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update({"abcF" : {%s : 1}}) +d.update({"abcF" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update({"abcF" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) +d.update({"abcF" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update({"abc" : Mapping({%s : 1})}) -d.update({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) -d.update({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update({"abcF" : Mapping({%s : 1})}) +d.update({"abcF" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update({"abcF" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) +d.update({"abcF" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d.update({"abc" : %s}) -d.update({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) -d.update({"abc" : FailingIterNext()}):(, NotImplementedError()) +>>> Testing *Iter* using d.update({"abcF" : %s}) +d.update({"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) +d.update({"abcF" : FailingIterNext()}):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d.update({"abc" : %s}) -d.update({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) -d.update({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) -d.update({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) -d.update({"abc" : FailingMapping()}):(, NotImplementedError()) -d.update({"abc" : FailingMappingKey()}):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d.update({"abcF" : %s}) +d.update({"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',)) +d.update({"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) +d.update({"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',)) +d.update({"abcF" : FailingMapping()}):(, NotImplementedError()) +d.update({"abcF" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update(Mapping({%s : 1})) d.update(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) d.update(Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) d.update(Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update(Mapping({"abc" : {%s : 1}})) -d.update(Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update(Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) -d.update(Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update(Mapping({"abcG" : {%s : 1}})) +d.update(Mapping({"abcG" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update(Mapping({"abcG" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) +d.update(Mapping({"abcG" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update(Mapping({"abc" : Mapping({%s : 1})})) -d.update(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update(Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) -d.update(Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update(Mapping({"abcG" : Mapping({%s : 1})})) +d.update(Mapping({"abcG" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update(Mapping({"abcG" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) +d.update(Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) -d.update(Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) +>>> Testing *Iter* using d.update(Mapping({"abcG" : %s})) +d.update(Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) +d.update(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d.update(Mapping({"abc" : %s})) -d.update(Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) -d.update(Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) -d.update(Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) -d.update(Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) -d.update(Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d.update(Mapping({"abcG" : %s})) +d.update(Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',)) +d.update(Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) +d.update(Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',)) +d.update(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError()) +d.update(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using d.update(%s) d.update(FailingIter()):(, NotImplementedError()) @@ -619,52 +622,52 @@ d.update((("a", {1 : 1}),)):(, TypeError('expected bytes() or d.update((("a", {b"\0" : 1}),)):(, TypeError('expected bytes with no null',)) d.update((("a", {"\0" : 1}),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update((("a", {"abc" : {%s : 1}}),)) -d.update((("a", {"abc" : {1 : 1}}),)):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update((("a", {"abc" : {b"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) -d.update((("a", {"abc" : {"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update((("a", {"abcF" : {%s : 1}}),)) +d.update((("a", {"abcF" : {1 : 1}}),)):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update((("a", {"abcF" : {b"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) +d.update((("a", {"abcF" : {"\0" : 1}}),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update((("a", {"abc" : Mapping({%s : 1})}),)) -d.update((("a", {"abc" : Mapping({1 : 1})}),)):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update((("a", {"abc" : Mapping({b"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) -d.update((("a", {"abc" : Mapping({"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update((("a", {"abcF" : Mapping({%s : 1})}),)) +d.update((("a", {"abcF" : Mapping({1 : 1})}),)):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update((("a", {"abcF" : Mapping({b"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) +d.update((("a", {"abcF" : Mapping({"\0" : 1})}),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : FailingIter()}),)):(, TypeError('unable to convert FailingIter to vim structure',)) -d.update((("a", {"abc" : FailingIterNext()}),)):(, NotImplementedError()) +>>> Testing *Iter* using d.update((("a", {"abcF" : %s}),)) +d.update((("a", {"abcF" : FailingIter()}),)):(, TypeError('unable to convert FailingIter to vim structure',)) +d.update((("a", {"abcF" : FailingIterNext()}),)):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d.update((("a", {"abc" : %s}),)) -d.update((("a", {"abc" : None}),)):(, TypeError('unable to convert NoneType to vim structure',)) -d.update((("a", {"abc" : {b"": 1}}),)):(, ValueError('empty keys are not allowed',)) -d.update((("a", {"abc" : {"": 1}}),)):(, ValueError('empty keys are not allowed',)) -d.update((("a", {"abc" : FailingMapping()}),)):(, NotImplementedError()) -d.update((("a", {"abc" : FailingMappingKey()}),)):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d.update((("a", {"abcF" : %s}),)) +d.update((("a", {"abcF" : None}),)):(, TypeError('unable to convert NoneType to vim structure',)) +d.update((("a", {"abcF" : {b"": 1}}),)):(, ValueError('empty keys are not allowed',)) +d.update((("a", {"abcF" : {"": 1}}),)):(, ValueError('empty keys are not allowed',)) +d.update((("a", {"abcF" : FailingMapping()}),)):(, NotImplementedError()) +d.update((("a", {"abcF" : FailingMappingKey()}),)):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using d.update((("a", Mapping({%s : 1})),)) d.update((("a", Mapping({1 : 1})),)):(, TypeError('expected bytes() or str() instance, but got int',)) d.update((("a", Mapping({b"\0" : 1})),)):(, TypeError('expected bytes with no null',)) d.update((("a", Mapping({"\0" : 1})),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update((("a", Mapping({"abc" : {%s : 1}})),)) -d.update((("a", Mapping({"abc" : {1 : 1}})),)):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update((("a", Mapping({"abc" : {b"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) -d.update((("a", Mapping({"abc" : {"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update((("a", Mapping({"abcG" : {%s : 1}})),)) +d.update((("a", Mapping({"abcG" : {1 : 1}})),)):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update((("a", Mapping({"abcG" : {b"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) +d.update((("a", Mapping({"abcG" : {"\0" : 1}})),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using d.update((("a", Mapping({"abc" : Mapping({%s : 1})})),)) -d.update((("a", Mapping({"abc" : Mapping({1 : 1})})),)):(, TypeError('expected bytes() or str() instance, but got int',)) -d.update((("a", Mapping({"abc" : Mapping({b"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) -d.update((("a", Mapping({"abc" : Mapping({"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using d.update((("a", Mapping({"abcG" : Mapping({%s : 1})})),)) +d.update((("a", Mapping({"abcG" : Mapping({1 : 1})})),)):(, TypeError('expected bytes() or str() instance, but got int',)) +d.update((("a", Mapping({"abcG" : Mapping({b"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) +d.update((("a", Mapping({"abcG" : Mapping({"\0" : 1})})),)):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : FailingIter()})),)):(, TypeError('unable to convert FailingIter to vim structure',)) -d.update((("a", Mapping({"abc" : FailingIterNext()})),)):(, NotImplementedError()) +>>> Testing *Iter* using d.update((("a", Mapping({"abcG" : %s})),)) +d.update((("a", Mapping({"abcG" : FailingIter()})),)):(, TypeError('unable to convert FailingIter to vim structure',)) +d.update((("a", Mapping({"abcG" : FailingIterNext()})),)):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abc" : %s})),)) -d.update((("a", Mapping({"abc" : None})),)):(, TypeError('unable to convert NoneType to vim structure',)) -d.update((("a", Mapping({"abc" : {b"": 1}})),)):(, ValueError('empty keys are not allowed',)) -d.update((("a", Mapping({"abc" : {"": 1}})),)):(, ValueError('empty keys are not allowed',)) -d.update((("a", Mapping({"abc" : FailingMapping()})),)):(, NotImplementedError()) -d.update((("a", Mapping({"abc" : FailingMappingKey()})),)):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using d.update((("a", Mapping({"abcG" : %s})),)) +d.update((("a", Mapping({"abcG" : None})),)):(, TypeError('unable to convert NoneType to vim structure',)) +d.update((("a", Mapping({"abcG" : {b"": 1}})),)):(, ValueError('empty keys are not allowed',)) +d.update((("a", Mapping({"abcG" : {"": 1}})),)):(, ValueError('empty keys are not allowed',)) +d.update((("a", Mapping({"abcG" : FailingMapping()})),)):(, NotImplementedError()) +d.update((("a", Mapping({"abcG" : FailingMappingKey()})),)):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using d.update((("a", %s),)) d.update((("a", FailingIter()),)):(, TypeError('unable to convert FailingIter to vim structure',)) @@ -694,52 +697,52 @@ vim.List([{1 : 1}]):(, TypeError('expected bytes() or str() i vim.List([{b"\0" : 1}]):(, TypeError('expected bytes with no null',)) vim.List([{"\0" : 1}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using vim.List([{"abc" : {%s : 1}}]) -vim.List([{"abc" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) -vim.List([{"abc" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) -vim.List([{"abc" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using vim.List([{"abcF" : {%s : 1}}]) +vim.List([{"abcF" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) +vim.List([{"abcF" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) +vim.List([{"abcF" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using vim.List([{"abc" : Mapping({%s : 1})}]) -vim.List([{"abc" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) -vim.List([{"abc" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) -vim.List([{"abc" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using vim.List([{"abcF" : Mapping({%s : 1})}]) +vim.List([{"abcF" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) +vim.List([{"abcF" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) +vim.List([{"abcF" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using vim.List([{"abc" : %s}]) -vim.List([{"abc" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) -vim.List([{"abc" : FailingIterNext()}]):(, NotImplementedError()) +>>> Testing *Iter* using vim.List([{"abcF" : %s}]) +vim.List([{"abcF" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) +vim.List([{"abcF" : FailingIterNext()}]):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using vim.List([{"abc" : %s}]) -vim.List([{"abc" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) -vim.List([{"abc" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) -vim.List([{"abc" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) -vim.List([{"abc" : FailingMapping()}]):(, NotImplementedError()) -vim.List([{"abc" : FailingMappingKey()}]):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using vim.List([{"abcF" : %s}]) +vim.List([{"abcF" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) +vim.List([{"abcF" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) +vim.List([{"abcF" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) +vim.List([{"abcF" : FailingMapping()}]):(, NotImplementedError()) +vim.List([{"abcF" : FailingMappingKey()}]):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using vim.List([Mapping({%s : 1})]) vim.List([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',)) vim.List([Mapping({b"\0" : 1})]):(, TypeError('expected bytes with no null',)) vim.List([Mapping({"\0" : 1})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using vim.List([Mapping({"abc" : {%s : 1}})]) -vim.List([Mapping({"abc" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) -vim.List([Mapping({"abc" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) -vim.List([Mapping({"abc" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using vim.List([Mapping({"abcG" : {%s : 1}})]) +vim.List([Mapping({"abcG" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) +vim.List([Mapping({"abcG" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) +vim.List([Mapping({"abcG" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using vim.List([Mapping({"abc" : Mapping({%s : 1})})]) -vim.List([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) -vim.List([Mapping({"abc" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) -vim.List([Mapping({"abc" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using vim.List([Mapping({"abcG" : Mapping({%s : 1})})]) +vim.List([Mapping({"abcG" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) +vim.List([Mapping({"abcG" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) +vim.List([Mapping({"abcG" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) -vim.List([Mapping({"abc" : FailingIterNext()})]):(, NotImplementedError()) +>>> Testing *Iter* using vim.List([Mapping({"abcG" : %s})]) +vim.List([Mapping({"abcG" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) +vim.List([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using vim.List([Mapping({"abc" : %s})]) -vim.List([Mapping({"abc" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) -vim.List([Mapping({"abc" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) -vim.List([Mapping({"abc" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) -vim.List([Mapping({"abc" : FailingMapping()})]):(, NotImplementedError()) -vim.List([Mapping({"abc" : FailingMappingKey()})]):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using vim.List([Mapping({"abcG" : %s})]) +vim.List([Mapping({"abcG" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) +vim.List([Mapping({"abcG" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) +vim.List([Mapping({"abcG" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) +vim.List([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError()) +vim.List([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using vim.List([%s]) vim.List([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',)) @@ -758,7 +761,7 @@ l[1000]:(, IndexError('list index out of range',)) ll[1] = 2:(, error('list is locked',)) l[1000] = 3:(, IndexError('list index out of range',)) >> ListAssSlice -ll[1:100] = "abc":(, error('list is locked',)) +ll[1:100] = "abcJ":(, error('list is locked',)) >>> Testing *Iter* using l[:] = %s l[:] = FailingIter():(, NotImplementedError()) l[:] = FailingIterNext()::(, NotImplementedError()) @@ -768,52 +771,52 @@ l[:] = [{1 : 1}]:(, TypeError('expected bytes() or str() inst l[:] = [{b"\0" : 1}]:(, TypeError('expected bytes with no null',)) l[:] = [{"\0" : 1}]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l[:] = [{"abc" : {%s : 1}}] -l[:] = [{"abc" : {1 : 1}}]:(, TypeError('expected bytes() or str() instance, but got int',)) -l[:] = [{"abc" : {b"\0" : 1}}]:(, TypeError('expected bytes with no null',)) -l[:] = [{"abc" : {"\0" : 1}}]:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l[:] = [{"abcF" : {%s : 1}}] +l[:] = [{"abcF" : {1 : 1}}]:(, TypeError('expected bytes() or str() instance, but got int',)) +l[:] = [{"abcF" : {b"\0" : 1}}]:(, TypeError('expected bytes with no null',)) +l[:] = [{"abcF" : {"\0" : 1}}]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l[:] = [{"abc" : Mapping({%s : 1})}] -l[:] = [{"abc" : Mapping({1 : 1})}]:(, TypeError('expected bytes() or str() instance, but got int',)) -l[:] = [{"abc" : Mapping({b"\0" : 1})}]:(, TypeError('expected bytes with no null',)) -l[:] = [{"abc" : Mapping({"\0" : 1})}]:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l[:] = [{"abcF" : Mapping({%s : 1})}] +l[:] = [{"abcF" : Mapping({1 : 1})}]:(, TypeError('expected bytes() or str() instance, but got int',)) +l[:] = [{"abcF" : Mapping({b"\0" : 1})}]:(, TypeError('expected bytes with no null',)) +l[:] = [{"abcF" : Mapping({"\0" : 1})}]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : FailingIter()}]:(, TypeError('unable to convert FailingIter to vim structure',)) -l[:] = [{"abc" : FailingIterNext()}]:(, NotImplementedError()) +>>> Testing *Iter* using l[:] = [{"abcF" : %s}] +l[:] = [{"abcF" : FailingIter()}]:(, TypeError('unable to convert FailingIter to vim structure',)) +l[:] = [{"abcF" : FailingIterNext()}]:(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using l[:] = [{"abc" : %s}] -l[:] = [{"abc" : None}]:(, TypeError('unable to convert NoneType to vim structure',)) -l[:] = [{"abc" : {b"": 1}}]:(, ValueError('empty keys are not allowed',)) -l[:] = [{"abc" : {"": 1}}]:(, ValueError('empty keys are not allowed',)) -l[:] = [{"abc" : FailingMapping()}]:(, NotImplementedError()) -l[:] = [{"abc" : FailingMappingKey()}]:(, NotImplementedError()) +>>> Testing ConvertFromPyObject using l[:] = [{"abcF" : %s}] +l[:] = [{"abcF" : None}]:(, TypeError('unable to convert NoneType to vim structure',)) +l[:] = [{"abcF" : {b"": 1}}]:(, ValueError('empty keys are not allowed',)) +l[:] = [{"abcF" : {"": 1}}]:(, ValueError('empty keys are not allowed',)) +l[:] = [{"abcF" : FailingMapping()}]:(, NotImplementedError()) +l[:] = [{"abcF" : FailingMappingKey()}]:(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l[:] = [Mapping({%s : 1})] l[:] = [Mapping({1 : 1})]:(, TypeError('expected bytes() or str() instance, but got int',)) l[:] = [Mapping({b"\0" : 1})]:(, TypeError('expected bytes with no null',)) l[:] = [Mapping({"\0" : 1})]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l[:] = [Mapping({"abc" : {%s : 1}})] -l[:] = [Mapping({"abc" : {1 : 1}})]:(, TypeError('expected bytes() or str() instance, but got int',)) -l[:] = [Mapping({"abc" : {b"\0" : 1}})]:(, TypeError('expected bytes with no null',)) -l[:] = [Mapping({"abc" : {"\0" : 1}})]:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l[:] = [Mapping({"abcG" : {%s : 1}})] +l[:] = [Mapping({"abcG" : {1 : 1}})]:(, TypeError('expected bytes() or str() instance, but got int',)) +l[:] = [Mapping({"abcG" : {b"\0" : 1}})]:(, TypeError('expected bytes with no null',)) +l[:] = [Mapping({"abcG" : {"\0" : 1}})]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l[:] = [Mapping({"abc" : Mapping({%s : 1})})] -l[:] = [Mapping({"abc" : Mapping({1 : 1})})]:(, TypeError('expected bytes() or str() instance, but got int',)) -l[:] = [Mapping({"abc" : Mapping({b"\0" : 1})})]:(, TypeError('expected bytes with no null',)) -l[:] = [Mapping({"abc" : Mapping({"\0" : 1})})]:(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l[:] = [Mapping({"abcG" : Mapping({%s : 1})})] +l[:] = [Mapping({"abcG" : Mapping({1 : 1})})]:(, TypeError('expected bytes() or str() instance, but got int',)) +l[:] = [Mapping({"abcG" : Mapping({b"\0" : 1})})]:(, TypeError('expected bytes with no null',)) +l[:] = [Mapping({"abcG" : Mapping({"\0" : 1})})]:(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : FailingIter()})]:(, TypeError('unable to convert FailingIter to vim structure',)) -l[:] = [Mapping({"abc" : FailingIterNext()})]:(, NotImplementedError()) +>>> Testing *Iter* using l[:] = [Mapping({"abcG" : %s})] +l[:] = [Mapping({"abcG" : FailingIter()})]:(, TypeError('unable to convert FailingIter to vim structure',)) +l[:] = [Mapping({"abcG" : FailingIterNext()})]:(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using l[:] = [Mapping({"abc" : %s})] -l[:] = [Mapping({"abc" : None})]:(, TypeError('unable to convert NoneType to vim structure',)) -l[:] = [Mapping({"abc" : {b"": 1}})]:(, ValueError('empty keys are not allowed',)) -l[:] = [Mapping({"abc" : {"": 1}})]:(, ValueError('empty keys are not allowed',)) -l[:] = [Mapping({"abc" : FailingMapping()})]:(, NotImplementedError()) -l[:] = [Mapping({"abc" : FailingMappingKey()})]:(, NotImplementedError()) +>>> Testing ConvertFromPyObject using l[:] = [Mapping({"abcG" : %s})] +l[:] = [Mapping({"abcG" : None})]:(, TypeError('unable to convert NoneType to vim structure',)) +l[:] = [Mapping({"abcG" : {b"": 1}})]:(, ValueError('empty keys are not allowed',)) +l[:] = [Mapping({"abcG" : {"": 1}})]:(, ValueError('empty keys are not allowed',)) +l[:] = [Mapping({"abcG" : FailingMapping()})]:(, NotImplementedError()) +l[:] = [Mapping({"abcG" : FailingMappingKey()})]:(, NotImplementedError()) <<< Finished >>> Testing *Iter* using l[:] = [%s] l[:] = [FailingIter()]:(, TypeError('unable to convert FailingIter to vim structure',)) @@ -836,52 +839,52 @@ l.extend([{1 : 1}]):(, TypeError('expected bytes() or str() i l.extend([{b"\0" : 1}]):(, TypeError('expected bytes with no null',)) l.extend([{"\0" : 1}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l.extend([{"abc" : {%s : 1}}]) -l.extend([{"abc" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) -l.extend([{"abc" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) -l.extend([{"abc" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l.extend([{"abcF" : {%s : 1}}]) +l.extend([{"abcF" : {1 : 1}}]):(, TypeError('expected bytes() or str() instance, but got int',)) +l.extend([{"abcF" : {b"\0" : 1}}]):(, TypeError('expected bytes with no null',)) +l.extend([{"abcF" : {"\0" : 1}}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l.extend([{"abc" : Mapping({%s : 1})}]) -l.extend([{"abc" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) -l.extend([{"abc" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) -l.extend([{"abc" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l.extend([{"abcF" : Mapping({%s : 1})}]) +l.extend([{"abcF" : Mapping({1 : 1})}]):(, TypeError('expected bytes() or str() instance, but got int',)) +l.extend([{"abcF" : Mapping({b"\0" : 1})}]):(, TypeError('expected bytes with no null',)) +l.extend([{"abcF" : Mapping({"\0" : 1})}]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using l.extend([{"abc" : %s}]) -l.extend([{"abc" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) -l.extend([{"abc" : FailingIterNext()}]):(, NotImplementedError()) +>>> Testing *Iter* using l.extend([{"abcF" : %s}]) +l.extend([{"abcF" : FailingIter()}]):(, TypeError('unable to convert FailingIter to vim structure',)) +l.extend([{"abcF" : FailingIterNext()}]):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using l.extend([{"abc" : %s}]) -l.extend([{"abc" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) -l.extend([{"abc" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) -l.extend([{"abc" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) -l.extend([{"abc" : FailingMapping()}]):(, NotImplementedError()) -l.extend([{"abc" : FailingMappingKey()}]):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using l.extend([{"abcF" : %s}]) +l.extend([{"abcF" : None}]):(, TypeError('unable to convert NoneType to vim structure',)) +l.extend([{"abcF" : {b"": 1}}]):(, ValueError('empty keys are not allowed',)) +l.extend([{"abcF" : {"": 1}}]):(, ValueError('empty keys are not allowed',)) +l.extend([{"abcF" : FailingMapping()}]):(, NotImplementedError()) +l.extend([{"abcF" : FailingMappingKey()}]):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using l.extend([Mapping({%s : 1})]) l.extend([Mapping({1 : 1})]):(, TypeError('expected bytes() or str() instance, but got int',)) l.extend([Mapping({b"\0" : 1})]):(, TypeError('expected bytes with no null',)) l.extend([Mapping({"\0" : 1})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l.extend([Mapping({"abc" : {%s : 1}})]) -l.extend([Mapping({"abc" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) -l.extend([Mapping({"abc" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) -l.extend([Mapping({"abc" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l.extend([Mapping({"abcG" : {%s : 1}})]) +l.extend([Mapping({"abcG" : {1 : 1}})]):(, TypeError('expected bytes() or str() instance, but got int',)) +l.extend([Mapping({"abcG" : {b"\0" : 1}})]):(, TypeError('expected bytes with no null',)) +l.extend([Mapping({"abcG" : {"\0" : 1}})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using l.extend([Mapping({"abc" : Mapping({%s : 1})})]) -l.extend([Mapping({"abc" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) -l.extend([Mapping({"abc" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) -l.extend([Mapping({"abc" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using l.extend([Mapping({"abcG" : Mapping({%s : 1})})]) +l.extend([Mapping({"abcG" : Mapping({1 : 1})})]):(, TypeError('expected bytes() or str() instance, but got int',)) +l.extend([Mapping({"abcG" : Mapping({b"\0" : 1})})]):(, TypeError('expected bytes with no null',)) +l.extend([Mapping({"abcG" : Mapping({"\0" : 1})})]):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) -l.extend([Mapping({"abc" : FailingIterNext()})]):(, NotImplementedError()) +>>> Testing *Iter* using l.extend([Mapping({"abcG" : %s})]) +l.extend([Mapping({"abcG" : FailingIter()})]):(, TypeError('unable to convert FailingIter to vim structure',)) +l.extend([Mapping({"abcG" : FailingIterNext()})]):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using l.extend([Mapping({"abc" : %s})]) -l.extend([Mapping({"abc" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) -l.extend([Mapping({"abc" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) -l.extend([Mapping({"abc" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) -l.extend([Mapping({"abc" : FailingMapping()})]):(, NotImplementedError()) -l.extend([Mapping({"abc" : FailingMappingKey()})]):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using l.extend([Mapping({"abcG" : %s})]) +l.extend([Mapping({"abcG" : None})]):(, TypeError('unable to convert NoneType to vim structure',)) +l.extend([Mapping({"abcG" : {b"": 1}})]):(, ValueError('empty keys are not allowed',)) +l.extend([Mapping({"abcG" : {"": 1}})]):(, ValueError('empty keys are not allowed',)) +l.extend([Mapping({"abcG" : FailingMapping()})]):(, NotImplementedError()) +l.extend([Mapping({"abcG" : FailingMappingKey()})]):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using l.extend([%s]) l.extend([FailingIter()]):(, TypeError('unable to convert FailingIter to vim structure',)) @@ -909,52 +912,52 @@ f({1 : 1}):(, TypeError('expected bytes() or str() instance, f({b"\0" : 1}):(, TypeError('expected bytes with no null',)) f({"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using f({"abc" : {%s : 1}}) -f({"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) -f({"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) -f({"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using f({"abcF" : {%s : 1}}) +f({"abcF" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) +f({"abcF" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) +f({"abcF" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using f({"abc" : Mapping({%s : 1})}) -f({"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) -f({"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) -f({"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using f({"abcF" : Mapping({%s : 1})}) +f({"abcF" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) +f({"abcF" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) +f({"abcF" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using f({"abc" : %s}) -f({"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) -f({"abc" : FailingIterNext()}):(, NotImplementedError()) +>>> Testing *Iter* using f({"abcF" : %s}) +f({"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) +f({"abcF" : FailingIterNext()}):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using f({"abc" : %s}) -f({"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) -f({"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) -f({"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) -f({"abc" : FailingMapping()}):(, NotImplementedError()) -f({"abc" : FailingMappingKey()}):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using f({"abcF" : %s}) +f({"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',)) +f({"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) +f({"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',)) +f({"abcF" : FailingMapping()}):(, NotImplementedError()) +f({"abcF" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using f(Mapping({%s : 1})) f(Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) f(Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) f(Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using f(Mapping({"abc" : {%s : 1}})) -f(Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) -f(Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) -f(Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using f(Mapping({"abcG" : {%s : 1}})) +f(Mapping({"abcG" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) +f(Mapping({"abcG" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) +f(Mapping({"abcG" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using f(Mapping({"abc" : Mapping({%s : 1})})) -f(Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) -f(Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) -f(Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using f(Mapping({"abcG" : Mapping({%s : 1})})) +f(Mapping({"abcG" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) +f(Mapping({"abcG" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) +f(Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) -f(Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) +>>> Testing *Iter* using f(Mapping({"abcG" : %s})) +f(Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) +f(Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using f(Mapping({"abc" : %s})) -f(Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) -f(Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) -f(Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) -f(Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) -f(Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using f(Mapping({"abcG" : %s})) +f(Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',)) +f(Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) +f(Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',)) +f(Mapping({"abcG" : FailingMapping()})):(, NotImplementedError()) +f(Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using f(%s) f(FailingIter()):(, TypeError('unable to convert FailingIter to vim structure',)) @@ -972,52 +975,52 @@ fd(self={1 : 1}):(, TypeError('expected bytes() or str() inst fd(self={b"\0" : 1}):(, TypeError('expected bytes with no null',)) fd(self={"\0" : 1}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using fd(self={"abc" : {%s : 1}}) -fd(self={"abc" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) -fd(self={"abc" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) -fd(self={"abc" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using fd(self={"abcF" : {%s : 1}}) +fd(self={"abcF" : {1 : 1}}):(, TypeError('expected bytes() or str() instance, but got int',)) +fd(self={"abcF" : {b"\0" : 1}}):(, TypeError('expected bytes with no null',)) +fd(self={"abcF" : {"\0" : 1}}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using fd(self={"abc" : Mapping({%s : 1})}) -fd(self={"abc" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) -fd(self={"abc" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) -fd(self={"abc" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using fd(self={"abcF" : Mapping({%s : 1})}) +fd(self={"abcF" : Mapping({1 : 1})}):(, TypeError('expected bytes() or str() instance, but got int',)) +fd(self={"abcF" : Mapping({b"\0" : 1})}):(, TypeError('expected bytes with no null',)) +fd(self={"abcF" : Mapping({"\0" : 1})}):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using fd(self={"abc" : %s}) -fd(self={"abc" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) -fd(self={"abc" : FailingIterNext()}):(, NotImplementedError()) +>>> Testing *Iter* using fd(self={"abcF" : %s}) +fd(self={"abcF" : FailingIter()}):(, TypeError('unable to convert FailingIter to vim structure',)) +fd(self={"abcF" : FailingIterNext()}):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using fd(self={"abc" : %s}) -fd(self={"abc" : None}):(, TypeError('unable to convert NoneType to vim structure',)) -fd(self={"abc" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) -fd(self={"abc" : {"": 1}}):(, ValueError('empty keys are not allowed',)) -fd(self={"abc" : FailingMapping()}):(, NotImplementedError()) -fd(self={"abc" : FailingMappingKey()}):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using fd(self={"abcF" : %s}) +fd(self={"abcF" : None}):(, TypeError('unable to convert NoneType to vim structure',)) +fd(self={"abcF" : {b"": 1}}):(, ValueError('empty keys are not allowed',)) +fd(self={"abcF" : {"": 1}}):(, ValueError('empty keys are not allowed',)) +fd(self={"abcF" : FailingMapping()}):(, NotImplementedError()) +fd(self={"abcF" : FailingMappingKey()}):(, NotImplementedError()) <<< Finished >>> Testing StringToChars using fd(self=Mapping({%s : 1})) fd(self=Mapping({1 : 1})):(, TypeError('expected bytes() or str() instance, but got int',)) fd(self=Mapping({b"\0" : 1})):(, TypeError('expected bytes with no null',)) fd(self=Mapping({"\0" : 1})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using fd(self=Mapping({"abc" : {%s : 1}})) -fd(self=Mapping({"abc" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) -fd(self=Mapping({"abc" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) -fd(self=Mapping({"abc" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using fd(self=Mapping({"abcG" : {%s : 1}})) +fd(self=Mapping({"abcG" : {1 : 1}})):(, TypeError('expected bytes() or str() instance, but got int',)) +fd(self=Mapping({"abcG" : {b"\0" : 1}})):(, TypeError('expected bytes with no null',)) +fd(self=Mapping({"abcG" : {"\0" : 1}})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing StringToChars using fd(self=Mapping({"abc" : Mapping({%s : 1})})) -fd(self=Mapping({"abc" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) -fd(self=Mapping({"abc" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) -fd(self=Mapping({"abc" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) +>>> Testing StringToChars using fd(self=Mapping({"abcG" : Mapping({%s : 1})})) +fd(self=Mapping({"abcG" : Mapping({1 : 1})})):(, TypeError('expected bytes() or str() instance, but got int',)) +fd(self=Mapping({"abcG" : Mapping({b"\0" : 1})})):(, TypeError('expected bytes with no null',)) +fd(self=Mapping({"abcG" : Mapping({"\0" : 1})})):(, TypeError('expected bytes with no null',)) <<< Finished ->>> Testing *Iter* using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) -fd(self=Mapping({"abc" : FailingIterNext()})):(, NotImplementedError()) +>>> Testing *Iter* using fd(self=Mapping({"abcG" : %s})) +fd(self=Mapping({"abcG" : FailingIter()})):(, TypeError('unable to convert FailingIter to vim structure',)) +fd(self=Mapping({"abcG" : FailingIterNext()})):(, NotImplementedError()) <<< Finished ->>> Testing ConvertFromPyObject using fd(self=Mapping({"abc" : %s})) -fd(self=Mapping({"abc" : None})):(, TypeError('unable to convert NoneType to vim structure',)) -fd(self=Mapping({"abc" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) -fd(self=Mapping({"abc" : {"": 1}})):(, ValueError('empty keys are not allowed',)) -fd(self=Mapping({"abc" : FailingMapping()})):(, NotImplementedError()) -fd(self=Mapping({"abc" : FailingMappingKey()})):(, NotImplementedError()) +>>> Testing ConvertFromPyObject using fd(self=Mapping({"abcG" : %s})) +fd(self=Mapping({"abcG" : None})):(, TypeError('unable to convert NoneType to vim structure',)) +fd(self=Mapping({"abcG" : {b"": 1}})):(, ValueError('empty keys are not allowed',)) +fd(self=Mapping({"abcG" : {"": 1}})):(, ValueError('empty keys are not allowed',)) +fd(self=Mapping({"abcG" : FailingMapping()})):(, NotImplementedError()) +fd(self=Mapping({"abcG" : FailingMappingKey()})):(, NotImplementedError()) <<< Finished >>> Testing *Iter* using fd(self=%s) fd(self=FailingIter()):(, TypeError('unable to convert FailingIter to vim dictionary',)) @@ -1046,8 +1049,8 @@ vim.current.window.xxx:(, AttributeError("'vim.window' o vim.current.window.buffer = 0:(, TypeError('readonly attribute: buffer',)) vim.current.window.cursor = (100000000, 100000000):(, error('cursor position outside buffer',)) vim.current.window.cursor = True:(, TypeError('argument must be 2-item sequence, not bool',)) -vim.current.window.height = "abc":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) -vim.current.window.width = "abc":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) +vim.current.window.height = "abcK":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) +vim.current.window.width = "abcL":(, TypeError('expected int() or something supporting coercing to int(), but got str',)) vim.current.window.xxxxxx = True:(, AttributeError('xxxxxx',)) > WinList >> WinListItem @@ -1057,7 +1060,7 @@ vim.windows[1000]:(, IndexError('no such window',)) vim.current.buffer[0] = "\na":(, error('string cannot contain newlines',)) >> SetBufferLine (indirect) vim.current.buffer[0] = True:(, TypeError('bad argument type for built-in operation',)) ->> SetBufferLines (indirect) +>> SetBufferLineList (indirect) vim.current.buffer[:] = True:(, TypeError('bad argument type for built-in operation',)) vim.current.buffer[:] = ["\na", "bc"]:(, error('string cannot contain newlines',)) >> InsertBufferLines (indirect) @@ -1075,7 +1078,7 @@ vim.current.buffer.name = True:(, TypeError('expected bytes() vim.current.buffer.xxx = True:(, AttributeError('xxx',)) >> BufferMark vim.current.buffer.mark(0):(, TypeError('expected bytes() or str() instance, but got int',)) -vim.current.buffer.mark("abc"):(, ValueError('mark name must be a single character',)) +vim.current.buffer.mark("abcM"):(, ValueError('mark name must be a single character',)) vim.current.buffer.mark("!"):(, error('invalid mark name',)) >> BufferRange vim.current.buffer.range(1, 2, 3):(, TypeError('function takes exactly 2 arguments (3 given)',)) @@ -1095,7 +1098,7 @@ vim.current.xxx = True:(, AttributeError('xxx',)) 3,xx before after -vim.command("throw 'abc'"):(, error('abc',)) +vim.command("throw 'abcN'"):(, error('abcN',)) Exe("throw 'def'"):(, error('def',)) vim.eval("Exe('throw ''ghi''')"):(, error('ghi',)) vim.eval("Exe('echoerr ''jkl''')"):(, error('Vim(echoerr):jkl',)) diff --git a/src/version.c b/src/version.c index bb95b5b18a..e4c7fba494 100644 --- a/src/version.c +++ b/src/version.c @@ -728,6 +728,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1233, /**/ 1232, /**/ From 427a1c67413ebeb08399f8bd8a75be63a5b3f521 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 23 Jun 2013 14:37:07 +0200 Subject: [PATCH 20/20] Added tag v7-3-1233 for changeset 4ed713442c51 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 298d9afb7b..797165d48d 100644 --- a/.hgtags +++ b/.hgtags @@ -2569,3 +2569,4 @@ b6e693e1f9461e5020e4cafa1c6e1de24776e11b v7-3-1229 f5c822e5a0eba6f490d0be9f6892de929295be87 v7-3-1230 537bbfff0c5c0bc2307a85133f59f07b00c55e41 v7-3-1231 a594ce86b5eade96cb84415b3b027abe611c2238 v7-3-1232 +4ed713442c51625160cd0bca612d9a3417e4ba14 v7-3-1233