Message158397
When parsing for inline comments, ConfigParser will only check the first occurrence of the delimiter in the line. If that instance of the delimiter isn't preceded with a space, it then assumes no comment. This ignores the fact that there could be a second instance of the delimiter which does have a preceding space. The result is that inline comments can be left as part of the value.
So, a config file of:
[section]
value1 = a;b
value2 = a ; comment
value3 = a; b ; comment
after parsing actually results in:
[section]
value1 = a;b
value2 = a
value3 = a; b ; comment
That is, 'value3' is incorrect as still embeds the inline comment.
Test script attached for Python 2.X.
Not tested on Python 3.X but code appears to do the same thing, except that on Python 3.X inline comments are disabled by default. |
|
Date |
User |
Action |
Args |
2012-04-16 01:57:48 | grahamd | set | recipients:
+ grahamd |
2012-04-16 01:57:48 | grahamd | set | messageid: <1334541468.07.0.833607995836.issue14590@psf.upfronthosting.co.za> |
2012-04-16 01:57:47 | grahamd | link | issue14590 messages |
2012-04-16 01:57:47 | grahamd | create | |
|