This needs to override the default traceback thing so it can put it into a pretty colour and maybe other stuff, I don't know
(self)
| 173 | self.writetb(exc_formatted) |
| 174 | |
| 175 | def showtraceback(self) -> None: |
| 176 | """This needs to override the default traceback thing |
| 177 | so it can put it into a pretty colour and maybe other |
| 178 | stuff, I don't know""" |
| 179 | try: |
| 180 | t, v, tb = sys.exc_info() |
| 181 | sys.last_type = t |
| 182 | sys.last_value = v |
| 183 | sys.last_traceback = tb |
| 184 | tblist = traceback.extract_tb(tb) |
| 185 | del tblist[:1] |
| 186 | |
| 187 | for frame in tblist: |
| 188 | if self.bpython_input_re.match(frame.filename): |
| 189 | # strip linecache line number |
| 190 | frame.filename = "<input>" |
| 191 | |
| 192 | l = traceback.format_list(tblist) |
| 193 | if l: |
| 194 | l.insert(0, "Traceback (most recent call last):\n") |
| 195 | l[len(l) :] = traceback.format_exception_only(t, v) |
| 196 | finally: |
| 197 | pass |
| 198 | |
| 199 | self.writetb(l) |
| 200 | |
| 201 | def writetb(self, lines: Iterable[str]) -> None: |
| 202 | """This outputs the traceback and should be overridden for anything |