def showsyntaxerror(self, filename=None, running_compiled_code=False):
    'Display the syntax error that just occurred.\n\n        This doesn\'t display a stack trace because there isn\'t one.\n\n        If a filename is given, it is stuffed in the exception instead\n        of what was there before (because Python\'s parser always uses\n        "<string>" when reading from a string).\n\n        If the syntax error occurred when running a compiled code (i.e. running_compile_code=True),\n        longer stack trace will be displayed.\n        '
    (etype, value, last_traceback) = self._get_exc_info()
    if (filename and issubclass(etype, SyntaxError)):
        try:
            value.filename = filename
        except:
            pass
    elist = (traceback.extract_tb(last_traceback) if running_compiled_code else [])
    stb = self.SyntaxTB.structured_traceback(etype, value, elist)
    self._showtraceback(etype, value, stb)
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).

If the syntax error occurred when running a compiled code (i.e. running_compile_code=True),
longer stack trace will be displayed.
def showsyntaxerror(self, filename=None, running_compiled_code=False):
    'Display the syntax error that just occurred.\n\n        This doesn\'t display a stack trace because there isn\'t one.\n\n        If a filename is given, it is stuffed in the exception instead\n        of what was there before (because Python\'s parser always uses\n        "<string>" when reading from a string).\n\n        If the syntax error occurred when running a compiled code (i.e. running_compile_code=True),\n        longer stack trace will be displayed.\n        '
    (etype, value, last_traceback) = self._get_exc_info()
    if (filename and issubclass(etype, SyntaxError)):
        try:
            value.filename = filename
        except:
            pass
    elist = (traceback.extract_tb(last_traceback) if running_compiled_code else [])
    stb = self.SyntaxTB.structured_traceback(etype, value, elist)
    self._showtraceback(etype, value, stb)