Proxies a traceback frame.
| 34 | |
| 35 | |
| 36 | class TracebackFrameProxy(object): |
| 37 | """Proxies a traceback frame.""" |
| 38 | |
| 39 | def __init__(self, tb): |
| 40 | self.tb = tb |
| 41 | self._tb_next = None |
| 42 | |
| 43 | @property |
| 44 | def tb_next(self): |
| 45 | return self._tb_next |
| 46 | |
| 47 | def set_next(self, next): |
| 48 | if tb_set_next is not None: |
| 49 | try: |
| 50 | tb_set_next(self.tb, next and next.tb or None) |
| 51 | except Exception: |
| 52 | # this function can fail due to all the hackery it does |
| 53 | # on various python implementations. We just catch errors |
| 54 | # down and ignore them if necessary. |
| 55 | pass |
| 56 | self._tb_next = next |
| 57 | |
| 58 | @property |
| 59 | def is_jinja_frame(self): |
| 60 | return '__jinja_template__' in self.tb.tb_frame.f_globals |
| 61 | |
| 62 | def __getattr__(self, name): |
| 63 | return getattr(self.tb, name) |
| 64 | |
| 65 | |
| 66 | def make_frame_proxy(frame): |
no outgoing calls
no test coverage detected
searching dependent graphs…