Author: Philip Jenvey <[email protected]>
Branch: py3.3
Changeset: r72649:70a5990e4f23
Date: 2014-08-01 17:11 -0700
http://bitbucket.org/pypy/pypy/changeset/70a5990e4f23/

Log:    fix translation (newlist vs wrap) and match cpython a bit more

diff --git a/pypy/interpreter/module.py b/pypy/interpreter/module.py
--- a/pypy/interpreter/module.py
+++ b/pypy/interpreter/module.py
@@ -3,7 +3,7 @@
 """
 
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.error import OperationError
+from pypy.interpreter.error import OperationError, oefmt
 from rpython.rlib.objectmodel import we_are_translated
 
 
@@ -125,12 +125,8 @@
         return space.wrap(u"<module %s from %s>" % (name, __file__))
 
     def descr_module__dir__(self, space):
-        try:
-            w__dict__ = space.getattr(self, space.wrap('__dict__'))
-            result = space.listview(w__dict__)
-            w_result = space.wrap(result)
-            return w_result
-        except OperationError as e:
-            if e.match(space, space.w_AttributeError):
-                return space.wrap([])
-            raise
+        w_dict = space.getattr(self, space.wrap('__dict__'))
+        if not space.isinstance_w(w_dict, space.w_dict):
+            raise oefmt(space.w_TypeError, "%N.__dict__ is not a dictionary",
+                        self)
+        return space.newlist(space.listview(w_dict))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to