[pypy-svn] r56106 - pypy/dist/pypy/interpreter

fijal at codespeak.net fijal at codespeak.net
Fri Jun 27 06:47:45 CEST 2008


Author: fijal
Date: Fri Jun 27 06:47:43 2008
New Revision: 56106

Modified:
   pypy/dist/pypy/interpreter/module.py
Log:
Don't explode when __file__ is missing or bogus


Modified: pypy/dist/pypy/interpreter/module.py
==============================================================================
--- pypy/dist/pypy/interpreter/module.py	(original)
+++ pypy/dist/pypy/interpreter/module.py	Fri Jun 27 06:47:43 2008
@@ -71,6 +71,9 @@
         name = space.str_w(space.repr(self.w_name))
         if isinstance(self, MixedModule):
             return space.wrap("<module %s (built-in)>" % name)
-        w___file__ = space.getattr(self, space.wrap('__file__'))
-        __file__ = space.str_w(space.repr(w___file__))
+        try:
+            w___file__ = space.getattr(self, space.wrap('__file__'))
+            __file__ = space.str_w(space.repr(w___file__))
+        except OperationError:
+            __file__ = '?'
         return space.wrap("<module %s from %s>" % (name, __file__))



More information about the Pypy-commit mailing list