Author: Wim Lavrijsen <wlavrij...@lbl.gov>
Branch: cppyy-packaging
Changeset: r94869:7fecec6b5a70
Date: 2018-07-15 21:43 -0700
http://bitbucket.org/pypy/pypy/changeset/7fecec6b5a70/

Log:    improved dir() for namespaces

diff --git a/pypy/module/_cppyy/pythonify.py b/pypy/module/_cppyy/pythonify.py
--- a/pypy/module/_cppyy/pythonify.py
+++ b/pypy/module/_cppyy/pythonify.py
@@ -29,7 +29,14 @@
 
 class CPPNamespaceMeta(CPPScopeMeta):
     def __dir__(self):
-        return self.__cppdecl__.__dir__()
+        # For Py3: can actually call base class __dir__ (lives in type)
+        values = set(self.__dict__.keys())
+        values.update(object.__dict__.keys())
+        values.update(type(self).__dict__.keys())
+
+        # add C++ entities
+        values.update(self.__cppdecl__.__dir__())
+        return list(values)
 
 class CPPClassMeta(CPPScopeMeta):
     pass
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to