]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.422 v7.3.422
authorBram Moolenaar <Bram@vim.org>
Sat, 4 Feb 2012 19:17:26 +0000 (20:17 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 Feb 2012 19:17:26 +0000 (20:17 +0100)
Problem:    Python 3 does not have __members__.
Solution:   Add "name" and "number" in another way. (lilydjwg)

src/if_py_both.h
src/if_python3.c
src/version.c

index 53c2167e1407e0e0099b1681002c2fd3cbaab9e5..aa2591267dedd0ef5937a383184c7caf5a8975fc 100644 (file)
@@ -1479,6 +1479,9 @@ static struct PyMethodDef BufferMethods[] = {
     {"append",     BufferAppend,       1,          "Append data to Vim buffer" },
     {"mark",       BufferMark,         1,          "Return (row,col) representing position of named mark" },
     {"range",      BufferRange,        1,          "Return a range object which represents the part of the given buffer between line numbers s and e" },
+#if PY_VERSION_HEX >= 0x03000000
+    {"__dir__",            BufferDir,          4,          "List its attributes" },
+#endif
     { NULL,        NULL,               0,          NULL }
 };
 
index 18d5b7779548c99f0120a1984a57e984b0a5bf27..ac6f1666c5abc3dc803ccd7acbc72dc7c11a0730 100644 (file)
@@ -468,6 +468,7 @@ get_py3_exceptions()
 static PyObject *BufferNew (buf_T *);
 static PyObject *WindowNew(win_T *);
 static PyObject *LineToString(const char *);
+static PyObject *BufferDir(PyObject *, PyObject *);
 
 static PyTypeObject RangeType;
 
@@ -961,12 +962,17 @@ BufferGetattro(PyObject *self, PyObject*nameobj)
        return Py_BuildValue("s", this->buf->b_ffname);
     else if (strcmp(name, "number") == 0)
        return Py_BuildValue("n", this->buf->b_fnum);
-    else if (strcmp(name,"__members__") == 0)
-       return Py_BuildValue("[ss]", "name", "number");
     else
        return PyObject_GenericGetAttr(self, nameobj);
 }
 
+    static PyObject *
+BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
+{
+    return Py_BuildValue("[sssss]", "name", "number",
+                                                  "append", "mark", "range");
+}
+
     static PyObject *
 BufferRepr(PyObject *self)
 {
index b7b6ae84d148b47d4e9bdf203544edc45b0be62f..545e42f189499cda9ebbcd1367c0fa060806d097 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    422,
 /**/
     421,
 /**/