'Overrides ConfigParser.ConfigParser.readfp() to ignore inline comments.'

def readfp(self, fp, filename=None):

    if (filename is None):
        try:
            filename = fp.name
        except AttributeError:
            filename = '<???>'
    commentless_fp = StringIO.StringIO()
    line = fp.readline()
    while line:
        pound_pos = line.find('#')
        if ((pound_pos > 0) and line[(pound_pos - 1)].isspace()):
            line = (line[:pound_pos].rstrip() + '\n')
        commentless_fp.write(line)
        line = fp.readline()
    commentless_fp.seek(0)
    ConfigParser.ConfigParser.readfp(self, commentless_fp, filename)
