1
0
forked from aniani/vim

updated for version 7.3.1047

Problem:    Python: dir() does not work properly.
Solution:   Python patch 8.  Add __dir__ method to all objects with custom
            tp_getattr supplemented by __members__ attribute for at least
            python-2* versions.  __members__ is not mentioned in python-3*
            dir() output even if it is accessible. (ZyX)
This commit is contained in:
Bram Moolenaar
2013-05-29 22:36:10 +02:00
parent 432b09c84d
commit dd8aca664d
8 changed files with 260 additions and 36 deletions

View File

@@ -666,7 +666,6 @@ call_PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems)
return PyType_GenericAlloc(type,nitems);
}
static PyObject *BufferDir(PyObject *);
static PyObject *OutputGetattro(PyObject *, PyObject *);
static int OutputSetattro(PyObject *, PyObject *, PyObject *);
static PyObject *BufferGetattro(PyObject *, PyObject *);
@@ -1094,14 +1093,6 @@ BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
return BufferSetattr((BufferObject *)(self), name, val);
}
static PyObject *
BufferDir(PyObject *self UNUSED)
{
return Py_BuildValue("[ssssssss]",
"name", "number", "vars", "options", "valid",
"append", "mark", "range");
}
/******************/
static PyObject *
@@ -1368,8 +1359,11 @@ static PySequenceMethods WinListAsSeq = {
static PyObject *
CurrentGetattro(PyObject *self, PyObject *nameobj)
{
PyObject *r;
GET_ATTR_STRING(name, nameobj);
return CurrentGetattr(self, name);
if (!(r = CurrentGetattr(self, name)))
return PyObject_GenericGetAttr(self, nameobj);
return r;
}
static int