'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
"<string>" when reading from a string).
The output is written by self.write(), below.'

def showsyntaxerror(self, filename=None):

    (type, value, tb) = sys.exc_info()
    sys.last_type = type
    sys.last_value = value
    sys.last_traceback = tb
    if (filename and (type is SyntaxError)):
        try:
            (msg, (dummy_filename, lineno, offset, line)) = value.args
        except ValueError:
            pass
        else:
            value = SyntaxError(msg, (filename, lineno, offset, line))
            sys.last_value = value
    if (sys.excepthook is sys.__excepthook__):
        lines = traceback.format_exception_only(type, value)
        self.write(''.join(lines))
    else:
        sys.excepthook(type, value, tb)
