[pypy-svn] r16985 - pypy/release/0.7.x/pypy/translator

arigo at codespeak.net arigo at codespeak.net
Sun Aug 28 13:01:14 CEST 2005


Author: arigo
Date: Sun Aug 28 13:01:13 2005
New Revision: 16985

Modified:
   pypy/release/0.7.x/pypy/translator/translator.py
Log:
Catch all errors while trying inspect.getsource().
It breaks randomly here and there and shows up sometimes when using %r
formatting :-(

ludal will look into CPython's inspect.py/tokenize.py...



Modified: pypy/release/0.7.x/pypy/translator/translator.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/translator.py	(original)
+++ pypy/release/0.7.x/pypy/translator/translator.py	Sun Aug 28 13:01:13 2005
@@ -73,11 +73,11 @@
                 print
             self.flowgraphs[func] = graph
             self.functions.append(func)
+            graph.func = func
             try:
                 import inspect
-                graph.func = func
                 graph.source = inspect.getsource(func)
-            except IOError:
+            except:
                 pass  # e.g. when func is defined interactively
         if called_by:
             self.callgraph[called_by, func, call_tag] = called_by, func



More information about the Pypy-commit mailing list