1 To: vim_dev@googlegroups.com
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
11 Problem: Python 3 does not have __members__.
12 Solution: Add "name" and "number" in another way. (lilydjwg)
13 Files: src/if_py_both.h, src/if_python3.c
16 *** ../vim-7.3.421/src/if_py_both.h 2011-09-07 19:30:17.000000000 +0200
17 --- src/if_py_both.h 2012-02-04 19:59:43.000000000 +0100
21 {"append", BufferAppend, 1, "Append data to Vim buffer" },
22 {"mark", BufferMark, 1, "Return (row,col) representing position of named mark" },
23 {"range", BufferRange, 1, "Return a range object which represents the part of the given buffer between line numbers s and e" },
24 + #if PY_VERSION_HEX >= 0x03000000
25 + {"__dir__", BufferDir, 4, "List its attributes" },
27 { NULL, NULL, 0, NULL }
30 *** ../vim-7.3.421/src/if_python3.c 2011-09-14 18:59:35.000000000 +0200
31 --- src/if_python3.c 2012-02-04 20:13:00.000000000 +0100
35 static PyObject *BufferNew (buf_T *);
36 static PyObject *WindowNew(win_T *);
37 static PyObject *LineToString(const char *);
38 + static PyObject *BufferDir(PyObject *, PyObject *);
40 static PyTypeObject RangeType;
44 return Py_BuildValue("s", this->buf->b_ffname);
45 else if (strcmp(name, "number") == 0)
46 return Py_BuildValue("n", this->buf->b_fnum);
47 - else if (strcmp(name,"__members__") == 0)
48 - return Py_BuildValue("[ss]", "name", "number");
50 return PyObject_GenericGetAttr(self, nameobj);
54 BufferRepr(PyObject *self)
56 static char repr[100];
58 return Py_BuildValue("s", this->buf->b_ffname);
59 else if (strcmp(name, "number") == 0)
60 return Py_BuildValue("n", this->buf->b_fnum);
62 return PyObject_GenericGetAttr(self, nameobj);
66 + BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
68 + return Py_BuildValue("[sssss]", "name", "number",
69 + "append", "mark", "range");
73 BufferRepr(PyObject *self)
75 static char repr[100];
76 *** ../vim-7.3.421/src/version.c 2012-01-28 18:03:30.000000000 +0100
77 --- src/version.c 2012-02-04 20:14:58.000000000 +0100
81 { /* Add new patch number below this line */
87 How To Keep A Healthy Level Of Insanity:
88 15. Five days in advance, tell your friends you can't attend their
89 party because you're not in the mood.
91 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
92 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
93 \\\ an exciting new programming language -- http://www.Zimbu.org ///
94 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///