class_docstr: A list of FrameSummary objects, representing a stack of frames.
class_docstr_tok: ["A","list","of","FrameSummary","objects",",","representing","a","stack","of","frames","."]
code: def _extract_from_extended_frame_gen(
      klass,
      frame_gen,
      *,
      limit=None,
      lookup_lines=True,
      capture_locals=False,
  ):
      # Same as extract but operates on a frame generator that yields
      # (frame, (lineno, end_lineno, colno, end_colno)) in the stack.
      # Only lineno is required, the remaining fields can be None if the
      # information is not available.
      if limit is None:
          limit = getattr(sys, "tracebacklimit", None)
          if limit is not None and limit < 0:
              limit = 0
      if limit is not None:
          if limit >= 0:
              frame_gen = itertools.islice(frame_gen, limit)
          else:
              frame_gen = collections.deque(frame_gen, maxlen=-limit)
  
      result = klass()
      fnames = set()
      for f, (lineno, end_lineno, colno, end_colno) in frame_gen:
          co = f.f_code
          filename = co.co_filename
          name = co.co_name
  
          fnames.add(filename)
          linecache.lazycache(filename, f.f_globals)
          # Must defer line lookups until we have called checkcache.
          if capture_locals:
              f_locals = f.f_locals
          else:
              f_locals = None
          result.append(
              FrameSummary(
                  filename,
                  lineno,
                  name,
                  lookup_line=False,
                  locals=f_locals,
                  end_lineno=end_lineno,
                  colno=colno,
                  end_colno=end_colno,
              )
          )
      for filename in fnames:
          linecache.checkcache(filename)
      # If immediate lookup was desired, trigger lookups now.
      if lookup_lines:
          for f in result:
              f.line
      return result
  
imports: import collections.abc
  import itertools
  import linecache
  import sys
  import textwrap
  from contextlib import suppress
label_desc: Use image node_id 2 for calling the StackSummary obj's underlying member method code with example usage: obj._extract_from_extended_frame_gen(klass, frame_gen) and returns: result