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 cleaned
(self, exceptions)
| 717 | |
| 718 | @contextmanager |
| 719 | def _hold_exceptions(self, exceptions): |
| 720 | """ |
| 721 | Context manager to ensure proper cleaning of exceptions references |
| 722 | |
| 723 | When given a chained exception instead of a traceback, |
| 724 | pdb may hold references to many objects which may leak memory. |
| 725 | |
| 726 | We use this context manager to make sure everything is properly cleaned |
| 727 | |
| 728 | """ |
| 729 | try: |
| 730 | self._chained_exceptions = exceptions |
| 731 | self._chained_exception_index = len(exceptions) - 1 |
| 732 | yield |
| 733 | finally: |
| 734 | # we can't put those in forget as otherwise they would |
| 735 | # be cleared on exception change |
| 736 | self._chained_exceptions = tuple() |
| 737 | self._chained_exception_index = 0 |
| 738 | |
| 739 | def _get_asyncio_task(self): |
| 740 | try: |