(self, typ, value, tb, source)
| 130 | typ = value = tb = None |
| 131 | |
| 132 | def _showtraceback(self, typ, value, tb, source): |
| 133 | sys.last_type = typ |
| 134 | sys.last_traceback = tb |
| 135 | value = value.with_traceback(tb) |
| 136 | # Set the line of text that the exception refers to |
| 137 | lines = source.splitlines() |
| 138 | if (source and typ is SyntaxError |
| 139 | and not value.text and value.lineno is not None |
| 140 | and len(lines) >= value.lineno): |
| 141 | value.text = lines[value.lineno - 1] |
| 142 | sys.last_exc = sys.last_value = value |
| 143 | if sys.excepthook is sys.__excepthook__: |
| 144 | self._excepthook(typ, value, tb) |
| 145 | else: |
| 146 | # If someone has set sys.excepthook, we let that take precedence |
| 147 | # over self.write |
| 148 | try: |
| 149 | sys.excepthook(typ, value, tb) |
| 150 | except SystemExit: |
| 151 | raise |
| 152 | except BaseException as e: |
| 153 | e.__context__ = None |
| 154 | e = e.with_traceback(e.__traceback__.tb_next) |
| 155 | print('Error in sys.excepthook:', file=sys.stderr) |
| 156 | sys.__excepthook__(type(e), e, e.__traceback__) |
| 157 | print(file=sys.stderr) |
| 158 | print('Original exception was:', file=sys.stderr) |
| 159 | sys.__excepthook__(typ, value, tb) |
| 160 | |
| 161 | def _excepthook(self, typ, value, tb): |
| 162 | # This method is being overwritten in |
no test coverage detected