def getframeinfo(frame, context=1):
 if istraceback(frame):
  lineno = frame.tb_lineno
  frame = frame.tb_frame
 else:
  lineno = frame.f_lineno
 if (not isframe(frame)):
  raise TypeError('{!r} is not a frame or traceback object'.format(frame))
 filename = (getsourcefile(frame) or getfile(frame))
 if (context > 0):
  start = ((lineno - 1) - (context // 2))
  try:
   (lines, lnum) = findsource(frame)
  except IOError:
   lines = index = None
  else:
   start = max(start, 1)
   start = max(0, min(start, (len(lines) - context)))
   lines = lines[start:(start + context)]
   index = ((lineno - 1) - start)
 else:
  lines = index = None
 return Traceback(filename, lineno, frame.f_code.co_name, lines, index)

def getframeinfo ( frame , context = 1 ) : if istraceback ( frame ) : lineno = frame . tb_lineno frame = frame . tb_frame else : lineno = frame . f_lineno if ( not isframe ( frame ) ) : raise TypeError ( '{!r} is not a frame or traceback object' . format ( frame ) ) filename = ( getsourcefile ( frame ) or getfile ( frame ) ) if ( context > 0 ) : start = ( ( lineno - 1 ) - ( context // 2 ) ) try : ( lines , lnum ) = findsource ( frame ) except IOError : lines = index = None else : start = max ( start , 1 ) start = max ( 0 , min ( start , ( len ( lines ) - context ) ) ) lines = lines [ start : ( start + context ) ] index = ( ( lineno - 1 ) - start ) else : lines = index = None return Traceback ( filename , lineno , frame . f_code . co_name , lines , index )
get information about a frame or traceback object .