Commits

Maciej Fijalkowski committed f2ada8b

should work better now

Comments (0)

Files changed (2)

_jitviewer/parser.py

     def html_repr(self):
         if self.filename is not None:
             code = self.getcode()
+            if code is None:
+                return self.bytecode_name
             opcode = self.code.map[self.bytecode_no]
             return '%s %s' % (self.bytecode_name, opcode.argstr)
         else:
         callstack.append((','.join(path_so_far), '%s in %s at %d' % (loop.name,
                                         loop.filename, loop.startlineno)))
 
-        startline, endline = loop.linerange
-        if loop.filename is not None:
+        if not loop.has_valid_code() or loop.filename is None:
+            startline = 0
+            source = CodeReprNoFile(loop)
+        else:
+            startline, endline = loop.linerange
             code = self.storage.load_code(loop.filename)[(loop.startlineno,
                                                           loop.name)]
             source = CodeRepr(inspect.getsource(code), code, loop)
-        else:
-            source = CodeReprNoFile(loop)
         d = {'html': flask.render_template('loop.html',
                                            source=source,
                                            current_loop=no,
 class CheckingLoopStorage(LoopStorage):
     def disassemble_code(self, fname, startlineno, name):
         result = super(CheckingLoopStorage, self).disassemble_code(fname, startlineno, name)
-        if result is None and fname is not None:
-            raise CannotFindFile(fname)
+        #if result is None and fname is not None:
+        #    raise CannotFindFile(fname)
         return result