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)
diff --git a/src/if_python3.c b/src/if_python3.c
index 923d046..02132d6 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -666,7 +666,6 @@
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 @@
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 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