Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r121:86f36e21deef
Date: 2011-06-03 17:10 +0200
http://bitbucket.org/pypy/jitviewer/changeset/86f36e21deef/

Log:    Instead of crashing at load-time if one of the loops' source code
        cannot be located, use a DummyLoop instance. At least it lets us
        inspect the other loops.

diff --git a/bin/jitviewer.py b/bin/jitviewer.py
--- a/bin/jitviewer.py
+++ b/bin/jitviewer.py
@@ -55,6 +55,10 @@
 class CannotFindFile(Exception):
     pass
 
+class DummyFunc(object):
+    def repr(self):
+        return '???'
+
 class Server(object):
     def __init__(self, storage):
         self.storage = storage
@@ -67,9 +71,12 @@
                 is_entry = True
             else:
                 is_entry = False
-            func = FunctionHtml.from_operations(loop.operations, self.storage,
-                                                limit=1,
-                                                inputargs=loop.inputargs)
+            try:
+                func = FunctionHtml.from_operations(loop.operations, 
self.storage,
+                                                    limit=1,
+                                                    inputargs=loop.inputargs)
+            except CannotFindFile:
+                func = DummyFunc()
             func.count = getattr(loop, 'count', '?')
             loops.append((is_entry, index, func))
         loops.sort(lambda a, b: cmp(b[2].count, a[2].count))
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to