]> hydra-www.ietfng.org Git - dyna2/commitdiff
merge.
authorTim Vieira <tim.f.vieira@gmail.com>
Wed, 10 Jul 2013 03:05:22 +0000 (23:05 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Wed, 10 Jul 2013 03:05:22 +0000 (23:05 -0400)
1  2 
src/Dyna/Backend/Python/errors.py

index f1be8a55a43c897b61be96c4e62112722da8d78e,b775d1b832f64a6a8ebc10218366ebf62a5ae8c7..030afdf01cfe6f9aef89fa2cbce63ae8f6382983
@@@ -26,52 -28,42 +28,41 @@@ class DynaInitializerException(Exceptio
          super(DynaInitializerException, self).__init__(msg)
  
  
 -def exception_handler(etype, evalue, tb):
  
- def crash_handler(interp):
 -    # once for the log file.
 -    with file(dotdynadir / 'crash.log', 'wb') as crashreport:
 -        h = VerboseTB(color_scheme='Linux',
 -                      call_pdb=False,
 -                      ostream=crashreport,
 -                      long_header=True,
 -                      include_vars=True,
 -                      check_cache=None)
 -        h(etype, evalue, tb)
++# TODO: we should package up all relevant state including compiler version,
++# codegen output, interpreter state (possibly without the chart -- because it
++# might be too big to email); input to repl.  This should all go into a tarball.
++def crash_handler():
 +    """
 +    Use our custom exception handler for handling uncaught exceptions.
 +    """
  
 -    show_traceback((etype, evalue, tb))
 +    def exception_handler(etype, evalue, tb):
 +        print 'FATAL ERROR (%s): %s' % (etype.__name__, evalue)
  
 -    # TODO: we should package up all relevant state including compiler
 -    # version, codegen output, interpreter state (possibly without the
 -    # chart -- because it might be too big to email); input to repl.
 -    # This should all go into a tarball.
 +        # once for the log file.
 +        with file(dotdynadir / 'crash.log', 'wb') as crashreport:
 +            h = VerboseTB(color_scheme='Linux',
 +                          call_pdb=False,
 +                          ostream=crashreport,
 +                          long_header=True,
 +                          include_vars=True,
 +                          check_cache=None)
 +            h(etype, evalue, tb)
  
 -    for hook in crash_handler.hooks:
 -        hook()
++        show_traceback((etype, evalue, tb))
  
-             # Dump the entirety of readline's history.  I do not think that
-             # we can easily distinguish what is this session or a different
-             # one, but this is more useful than nothing.
-             #
-             # XXX Well, that'd be great, except that it doesn't work.
 -    print 'FATAL ERROR (%s): %s' % (etype.__name__, evalue)
 -    print 'Crash log available %s' % crashreport.name
++        for hook in crash_handler.hooks:
++            hook()
  
-             if interp is not None:
-                 if interp._repl is not None:
-                     crashreport.write("REPL history:\n")
-                     for ix in xrange(1,readline.get_current_history_length()):
-                         crashreport.write("%d: %s\n" \
-                             % (ix,readline.get_history_entry(ix)))
++        print 'Crash log available %s' % crashreport.name
  
-                 # TODO: we should package up all relevant state including
-                 # compiler version, codegen output, interpreter state
-                 # (possibly without the chart -- because it might be too big
-                 # to email); input to repl.  This should all go into a
-                 # tarball.
 -def crash_handler():
 -    """
 -    Use our custom exception handler for handling uncaught exceptions.
 -    """
+     sys.excepthook = exception_handler
  
-         show_traceback((etype, evalue, tb))
 -
+ crash_handler.hooks = []
  
-         print 'Crash log available %s' % crashreport.name
  
-     sys.excepthook = exception_handler
 +
  def show_traceback(einfo=None):
      if not einfo:
          einfo = sys.exc_info()