[pypy-svn] r56168 - in pypy/dist/pypy/interpreter: . test

arigo at codespeak.net arigo at codespeak.net
Sun Jun 29 00:02:22 CEST 2008


Author: arigo
Date: Sun Jun 29 00:02:20 2008
New Revision: 56168

Modified:
   pypy/dist/pypy/interpreter/module.py
   pypy/dist/pypy/interpreter/test/test_module.py
Log:
Test and fix.


Modified: pypy/dist/pypy/interpreter/module.py
==============================================================================
--- pypy/dist/pypy/interpreter/module.py	(original)
+++ pypy/dist/pypy/interpreter/module.py	Sun Jun 29 00:02:20 2008
@@ -69,7 +69,10 @@
 
     def descr_module__repr__(self, space):
         from pypy.interpreter.mixedmodule import MixedModule
-        name = space.str_w(space.repr(self.w_name))
+        if self.w_name is not None:
+            name = space.str_w(space.repr(self.w_name))
+        else:
+            name = "'?'"
         if isinstance(self, MixedModule):
             return space.wrap("<module %s (built-in)>" % name)
         try:

Modified: pypy/dist/pypy/interpreter/test/test_module.py
==============================================================================
--- pypy/dist/pypy/interpreter/test/test_module.py	(original)
+++ pypy/dist/pypy/interpreter/test/test_module.py	Sun Jun 29 00:02:20 2008
@@ -65,3 +65,6 @@
                r.endswith('>')
         nofile = type(_exceptions)('nofile', 'foo')
         assert repr(nofile) == "<module 'nofile' from ?>"
+
+        m = type(_exceptions).__new__(type(_exceptions))
+        assert repr(m).startswith("<module '?'")



More information about the Pypy-commit mailing list