code: def showsyntaxerror(self, filename=None):
          
          type, value, sys.last_traceback = sys.exc_info()
          sys.last_type = type
          sys.last_value = value
          if filename and type is SyntaxError:
              # Work hard to stuff the correct filename in the exception
              try:
                  msg, (dummy_filename, lineno, offset, line) = value
              except:
                  # Not the format we expect; leave it alone
                  pass
              else:
                  # Stuff in the right filename
                  value = SyntaxError(msg, (filename, lineno, offset, line))
                  sys.last_value = value
          list = traceback.format_exception_only(type, value)
          map(self.write, list)
docs: 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.