class_docstr: Context manager for dynamic management of a stack of exit callbacks
  
  For example:
  
      with ExitStack() as stack:
          files = [stack.enter_context(open(fname)) for fname in filenames]
          # All opened files will automatically be closed at the end of
          # the with statement, even if attempts to open files later
          # in the list raise an exception
class_docstr_tok: ["Context","manager","for","dynamic","management","of","a","stack","of","exit","callbacks","For","example",":","with","ExitStack","(",")","as","stack",":","files","=","[","stack.enter_context","(","open","(","fname",")",")","for","fname","in","filenames","]","#","All","opened","files","will","automatically","be","closed","at","the","end","of","#","the","with","statement",",","even","if","attempts","to","open","files","later","#","in","the","list","raise","an","exception"]
code: def __exit__(self, *exc_details):
      received_exc = exc_details[0] is not None
  
      # We manipulate the exception state so it behaves as though
      # we were actually nesting multiple with statements
      frame_exc = sys.exc_info()[1]
      _fix_exception_context = _make_context_fixer(frame_exc)
  
      # Callbacks are invoked in LIFO order to match the behaviour of
      # nested context managers
      suppressed_exc = False
      pending_raise = False
      while self._exit_callbacks:
          cb = self._exit_callbacks.pop()
          try:
              if cb(*exc_details):
                  suppressed_exc = True
                  pending_raise = False
                  exc_details = (None, None, None)
          except:
              new_exc_details = sys.exc_info()
              # simulate the stack of exceptions by setting the context
              _fix_exception_context(new_exc_details[1], exc_details[1])
              pending_raise = True
              exc_details = new_exc_details
      if pending_raise:
          _reraise_with_existing_context(exc_details)
      return received_exc and suppressed_exc
  
imports: import abc
  import sys
  import warnings
  from collections import deque
  from functools import wraps
label_desc: Use image node_id 9 for calling the ExitStack obj's underlying member method code with example usage: obj.__exit__() and returns: unknown