]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.1060 v7.3.1060
authorBram Moolenaar <Bram@vim.org>
Thu, 30 May 2013 10:43:54 +0000 (12:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 30 May 2013 10:43:54 +0000 (12:43 +0200)
Problem:    Python: can't repr() a function.
Solution:   Python patch 19: add FunctionRepr(). (ZyX)

src/if_py_both.h
src/version.c

index 97721b20f6a58b599ca2530b7d49171bfa86c842..edae12bef0b569e88f6c33afd50b4f1f59e5d345 100644 (file)
@@ -1584,6 +1584,12 @@ FunctionCall(FunctionObject *self, PyObject *argsObject, PyObject *kwargs)
     return result;
 }
 
+    static PyObject *
+FunctionRepr(FunctionObject *self)
+{
+    return PyString_FromFormat("<vim.Function '%s'>", self->name);
+}
+
 static struct PyMethodDef FunctionMethods[] = {
     {"__call__",(PyCFunction)FunctionCall,  METH_VARARGS|METH_KEYWORDS,        ""},
     {"__dir__",        (PyCFunction)FunctionDir,   METH_NOARGS,                ""},
@@ -4640,6 +4646,7 @@ init_structs(void)
     FunctionType.tp_flags = Py_TPFLAGS_DEFAULT;
     FunctionType.tp_doc = "object that calls vim function";
     FunctionType.tp_methods = FunctionMethods;
+    FunctionType.tp_repr = (reprfunc)FunctionRepr;
 #if PY_MAJOR_VERSION >= 3
     FunctionType.tp_getattro = (getattrofunc)FunctionGetattro;
 #else
index b8f82f1d703572c09eeb537b4b618276ada2aae9..ec01993babc9624db864040b529ad74ed944b7ea 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1060,
 /**/
     1059,
 /**/