Display the syntax error that just occurred. This doesn't display a stack trace because there isn't one. If a filename is given, it is stuffed in the exception instead of what was there before (because Python's parser always uses " " when reading from a strin
(self, filename=None, **kwargs)
| 95 | self.showtraceback() |
| 96 | |
| 97 | def showsyntaxerror(self, filename=None, **kwargs): |
| 98 | """Display the syntax error that just occurred. |
| 99 | |
| 100 | This doesn't display a stack trace because there isn't one. |
| 101 | |
| 102 | If a filename is given, it is stuffed in the exception instead |
| 103 | of what was there before (because Python's parser always uses |
| 104 | "<string>" when reading from a string). |
| 105 | |
| 106 | The output is written by self.write(), below. |
| 107 | |
| 108 | """ |
| 109 | try: |
| 110 | typ, value, tb = sys.exc_info() |
| 111 | if filename and issubclass(typ, SyntaxError): |
| 112 | value.filename = filename |
| 113 | source = kwargs.pop('source', "") |
| 114 | self._showtraceback(typ, value, None, source) |
| 115 | finally: |
| 116 | typ = value = tb = None |
| 117 | |
| 118 | def showtraceback(self): |
| 119 | """Display the exception that just occurred. |
no test coverage detected