ConfigParser: whitespace leading comment lines

gwillden at gwillden at
Thu Oct 12 22:13:19 CEST 2006

Hello all,
I'd like to propose the following change to
I won't call it a bug-fix because I don't know the relevant standards.
This change will enable multiline comments as follows:

item=value   ;first of multiline comment
            ;second of multiline comment

Right now the behaviour is

In [19]: cfg.get('section','item')
Out[19]: 'value\n;second of multiline comment'

It's a one-line change.
RawConfigParser._read lines 434-437
            # comment or blank line?
-            if line.strip() == '' or line[0] in '#;':
+            if line.strip() == '' or line.strip()[0] in '#;':

Greg Willden

More information about the Python-list mailing list