Karsten Hopp e49773
To: vim_dev@googlegroups.com
Karsten Hopp e49773
Subject: Patch 7.3.422
Karsten Hopp e49773
Fcc: outbox
Karsten Hopp e49773
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e49773
Mime-Version: 1.0
Karsten Hopp e49773
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e49773
Content-Transfer-Encoding: 8bit
Karsten Hopp e49773
------------
Karsten Hopp e49773
Karsten Hopp e49773
Patch 7.3.422
Karsten Hopp e49773
Problem:    Python 3 does not have __members__.
Karsten Hopp e49773
Solution:   Add "name" and "number" in another way. (lilydjwg)
Karsten Hopp e49773
Files:      src/if_py_both.h, src/if_python3.c
Karsten Hopp e49773
Karsten Hopp e49773
Karsten Hopp e49773
*** ../vim-7.3.421/src/if_py_both.h	2011-09-07 19:30:17.000000000 +0200
Karsten Hopp e49773
--- src/if_py_both.h	2012-02-04 19:59:43.000000000 +0100
Karsten Hopp e49773
***************
Karsten Hopp e49773
*** 1479,1484 ****
Karsten Hopp e49773
--- 1479,1487 ----
Karsten Hopp e49773
      {"append",	    BufferAppend,	1,	    "Append data to Vim buffer" },
Karsten Hopp e49773
      {"mark",	    BufferMark,		1,	    "Return (row,col) representing position of named mark" },
Karsten Hopp e49773
      {"range",	    BufferRange,	1,	    "Return a range object which represents the part of the given buffer between line numbers s and e" },
Karsten Hopp e49773
+ #if PY_VERSION_HEX >= 0x03000000
Karsten Hopp e49773
+     {"__dir__",	    BufferDir,		4,	    "List its attributes" },
Karsten Hopp e49773
+ #endif
Karsten Hopp e49773
      { NULL,	    NULL,		0,	    NULL }
Karsten Hopp e49773
  };
Karsten Hopp e49773
  
Karsten Hopp e49773
*** ../vim-7.3.421/src/if_python3.c	2011-09-14 18:59:35.000000000 +0200
Karsten Hopp e49773
--- src/if_python3.c	2012-02-04 20:13:00.000000000 +0100
Karsten Hopp e49773
***************
Karsten Hopp e49773
*** 468,473 ****
Karsten Hopp e49773
--- 468,474 ----
Karsten Hopp e49773
  static PyObject *BufferNew (buf_T *);
Karsten Hopp e49773
  static PyObject *WindowNew(win_T *);
Karsten Hopp e49773
  static PyObject *LineToString(const char *);
Karsten Hopp e49773
+ static PyObject *BufferDir(PyObject *, PyObject *);
Karsten Hopp e49773
  
Karsten Hopp e49773
  static PyTypeObject RangeType;
Karsten Hopp e49773
  
Karsten Hopp e49773
***************
Karsten Hopp e49773
*** 961,973 ****
Karsten Hopp e49773
  	return Py_BuildValue("s", this->buf->b_ffname);
Karsten Hopp e49773
      else if (strcmp(name, "number") == 0)
Karsten Hopp e49773
  	return Py_BuildValue("n", this->buf->b_fnum);
Karsten Hopp e49773
-     else if (strcmp(name,"__members__") == 0)
Karsten Hopp e49773
- 	return Py_BuildValue("[ss]", "name", "number");
Karsten Hopp e49773
      else
Karsten Hopp e49773
  	return PyObject_GenericGetAttr(self, nameobj);
Karsten Hopp e49773
  }
Karsten Hopp e49773
  
Karsten Hopp e49773
      static PyObject *
Karsten Hopp e49773
  BufferRepr(PyObject *self)
Karsten Hopp e49773
  {
Karsten Hopp e49773
      static char repr[100];
Karsten Hopp e49773
--- 962,979 ----
Karsten Hopp e49773
  	return Py_BuildValue("s", this->buf->b_ffname);
Karsten Hopp e49773
      else if (strcmp(name, "number") == 0)
Karsten Hopp e49773
  	return Py_BuildValue("n", this->buf->b_fnum);
Karsten Hopp e49773
      else
Karsten Hopp e49773
  	return PyObject_GenericGetAttr(self, nameobj);
Karsten Hopp e49773
  }
Karsten Hopp e49773
  
Karsten Hopp e49773
      static PyObject *
Karsten Hopp e49773
+ BufferDir(PyObject *self UNUSED, PyObject *args UNUSED)
Karsten Hopp e49773
+ {
Karsten Hopp e49773
+     return Py_BuildValue("[sssss]", "name", "number",
Karsten Hopp e49773
+ 						   "append", "mark", "range");
Karsten Hopp e49773
+ }
Karsten Hopp e49773
+ 
Karsten Hopp e49773
+     static PyObject *
Karsten Hopp e49773
  BufferRepr(PyObject *self)
Karsten Hopp e49773
  {
Karsten Hopp e49773
      static char repr[100];
Karsten Hopp e49773
*** ../vim-7.3.421/src/version.c	2012-01-28 18:03:30.000000000 +0100
Karsten Hopp e49773
--- src/version.c	2012-02-04 20:14:58.000000000 +0100
Karsten Hopp e49773
***************
Karsten Hopp e49773
*** 716,717 ****
Karsten Hopp e49773
--- 716,719 ----
Karsten Hopp e49773
  {   /* Add new patch number below this line */
Karsten Hopp e49773
+ /**/
Karsten Hopp e49773
+     422,
Karsten Hopp e49773
  /**/
Karsten Hopp e49773
Karsten Hopp e49773
-- 
Karsten Hopp e49773
How To Keep A Healthy Level Of Insanity:
Karsten Hopp e49773
15. Five days in advance, tell your friends you can't attend their
Karsten Hopp e49773
    party because you're not in the mood.
Karsten Hopp e49773
Karsten Hopp e49773
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e49773
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e49773
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e49773
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///