From dd8aca664d9768614d18cebec84badc3ecad3af5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 29 May 2013 22:36:10 +0200 Subject: 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) --- src/if_python3.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/if_python3.c') diff --git a/src/if_python3.c b/src/if_python3.c index 923d04696..02132d63d 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -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 -- cgit v1.2.1