Actually show a traceback. Subclasses may override this method to put the traceback on a different place, like a side channel.
(self, etype, evalue, stb: list[str])
| 2244 | print('\n' + self.get_exception_only(), file=sys.stderr) |
| 2245 | |
| 2246 | def _showtraceback(self, etype, evalue, stb: list[str]): |
| 2247 | """Actually show a traceback. |
| 2248 | |
| 2249 | Subclasses may override this method to put the traceback on a different |
| 2250 | place, like a side channel. |
| 2251 | """ |
| 2252 | val = self.InteractiveTB.stb2text(stb) |
| 2253 | self.showing_traceback = True |
| 2254 | try: |
| 2255 | print(val) |
| 2256 | except UnicodeEncodeError: |
| 2257 | print(val.encode("utf-8", "backslashreplace").decode()) |
| 2258 | self.showing_traceback = False |
| 2259 | |
| 2260 | def showsyntaxerror(self, filename=None, running_compiled_code=False): |
| 2261 | """Display the syntax error that just occurred. |