MCPcopy Index your code
hub / github.com/ipython/ipython / _hold_exceptions

Method _hold_exceptions

IPython/core/debugger.py:473–488  ·  view source on GitHub ↗

Context manager to ensure proper cleaning of exceptions references When given a chained exception instead of a traceback, pdb may hold references to many objects which may leak memory. We use this context manager to make sure everything is properly cl

(self, exceptions)

Source from the content-addressed store, hash-verified

471
472 @contextmanager
473 def _hold_exceptions(self, exceptions):
474 """
475 Context manager to ensure proper cleaning of exceptions references
476 When given a chained exception instead of a traceback,
477 pdb may hold references to many objects which may leak memory.
478 We use this context manager to make sure everything is properly cleaned
479 """
480 try:
481 self._chained_exceptions = exceptions
482 self._chained_exception_index = len(exceptions) - 1
483 yield
484 finally:
485 # we can't put those in forget as otherwise they would
486 # be cleared on exception change
487 self._chained_exceptions = tuple()
488 self._chained_exception_index = 0
489
490 def do_exceptions(self, arg):
491 """exceptions [number]

Callers 1

interactionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected