parameters: (self)
return_statement: return new_stack
docstring: Preserve the context stack by transferring it to a new instance
docstring_summary: Preserve the context stack by transferring it to a new instance
docstring_tokens: Preserve the context stack by transferring it to a new instance
function: def pop_all(self):
          """Preserve the context stack by transferring it to a new instance"""
          new_stack = type(self)()
          new_stack._exit_callbacks = self._exit_callbacks
          self._exit_callbacks = deque()
          return new_stack
function_tokens: def pop_all ( self ) : new_stack = type ( self ) ( ) new_stack . _exit_callbacks = self . _exit_callbacks self . _exit_callbacks = deque ( ) return new_stack