parameters: (exc_info, filename, lineno)
return_statement: return exc_info[:2] + (new_tb,)
docstring: Helper for `translate_exception`.
docstring_summary: Helper for `translate_exception`.
docstring_tokens: Helper for translate_exception .
function: def fake_exc_info(exc_info, filename, lineno):
      """Helper for `translate_exception`."""
      exc_type, exc_value, tb = exc_info
  
      # figure the real context out
      if tb is not None:
          locals = get_jinja_locals(tb.tb_frame.f_locals)
  
          # if there is a local called __jinja_exception__, we get
          # rid of it to not break the debug functionality.
          locals.pop('__jinja_exception__', None)
      else:
          locals = {}
  
      # assamble fake globals we need
      globals = {
          '__name__':             filename,
          '__file__':             filename,
          '__jinja_exception__':  exc_info[:2],
  
          # we don't want to keep the reference to the template around
          # to not cause circular dependencies, but we mark it as Jinja
          # frame for the ProcessedTraceback
          '__jinja_template__':   None
      }
  
      # and fake the exception
      code = compile('\n' * (lineno - 1) + raise_helper, filename, 'exec')
  
      # if it's possible, change the name of the code.  This won't work
      # on some python environments such as google appengine
      try:
          if tb is None:
              location = 'template'
          else:
              function = tb.tb_frame.f_code.co_name
              if function == 'root':
                  location = 'top-level template code'
              elif function.startswith('block_'):
                  location = 'block "%s"' % function[6:]
              else:
                  location = 'template'
  
          if PY2:
              code = CodeType(0, code.co_nlocals, code.co_stacksize,
                              code.co_flags, code.co_code, code.co_consts,
                              code.co_names, code.co_varnames, filename,
                              location, code.co_firstlineno,
                              code.co_lnotab, (), ())
          else:
              code = CodeType(0, code.co_kwonlyargcount,
                              code.co_nlocals, code.co_stacksize,
                              code.co_flags, code.co_code, code.co_consts,
                              code.co_names, code.co_varnames, filename,
                              location, code.co_firstlineno,
                              code.co_lnotab, (), ())
      except Exception as e:
          pass
  
      # execute the code and catch the new traceback
      try:
          exec(code, globals, locals)
      except:
          exc_info = sys.exc_info()
          new_tb = exc_info[2].tb_next
  
      # return without this frame
      return exc_info[:2] + (new_tb,)
function_tokens: def fake_exc_info ( exc_info , filename , lineno ) : exc_type , exc_value , tb = exc_info # figure the real context out if tb is not None : locals = get_jinja_locals ( tb . tb_frame . f_locals ) # if there is a local called __jinja_exception__, we get # rid of it to not break the debug functionality. locals . pop ( '__jinja_exception__' , None ) else : locals = { } # assamble fake globals we need globals = { '__name__' : filename , '__file__' : filename , '__jinja_exception__' : exc_info [ : 2 ] , # we don't want to keep the reference to the template around # to not cause circular dependencies, but we mark it as Jinja # frame for the ProcessedTraceback '__jinja_template__' : None } # and fake the exception code = compile ( '\n' * ( lineno - 1 ) + raise_helper , filename , 'exec' ) # if it's possible, change the name of the code.  This won't work # on some python environments such as google appengine try : if tb is None : location = 'template' else : function = tb . tb_frame . f_code . co_name if function == 'root' : location = 'top-level template code' elif function . startswith ( 'block_' ) : location = 'block "%s"' % function [ 6 : ] else : location = 'template' if PY2 : code = CodeType ( 0 , code . co_nlocals , code . co_stacksize , code . co_flags , code . co_code , code . co_consts , code . co_names , code . co_varnames , filename , location , code . co_firstlineno , code . co_lnotab , ( ) , ( ) ) else : code = CodeType ( 0 , code . co_kwonlyargcount , code . co_nlocals , code . co_stacksize , code . co_flags , code . co_code , code . co_consts , code . co_names , code . co_varnames , filename , location , code . co_firstlineno , code . co_lnotab , ( ) , ( ) ) except Exception as e : pass # execute the code and catch the new traceback try : exec ( code , globals , locals ) except : exc_info = sys . exc_info ( ) new_tb = exc_info [ 2 ] . tb_next # return without this frame return exc_info [ : 2 ] + ( new_tb , )