summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-05-30 12:43:54 +0200
committerBram Moolenaar <Bram@vim.org>2013-05-30 12:43:54 +0200
commita5b725c3f67f1c98d99fec71a3cbaad502a02291 (patch)
treec69f3db5c754578543b21f77d51aa796aa83de2d
parent1a3b56953e22f9e50d34c50edb5c24292741eb3d (diff)
downloadvim-git-7.3.1060.tar.gz
updated for version 7.3.1060v7.3.1060
Problem: Python: can't repr() a function. Solution: Python patch 19: add FunctionRepr(). (ZyX)
-rw-r--r--src/if_py_both.h7
-rw-r--r--src/version.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 97721b20f..edae12bef 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -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
diff --git a/src/version.c b/src/version.c
index b8f82f1d7..ec01993ba 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1060,
+/**/
1059,
/**/
1058,