This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Nacsa.Kristóf
Recipients Nacsa.Kristóf
Date 2013-10-31.17:24:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1383240246.91.0.876276014549.issue19461@psf.upfronthosting.co.za>
In-reply-to
Content
http://hg.python.org/cpython/file/8d5df9602a72/Lib/ConfigParser.py#l529

RawConfigParser has a special case of replacing '""' with '' in reader.
However the writer does not do the same.

This may cause problems, for example if you merge multiple ini files into one and the 3rd party program that should use the output segfaults on an ini that has `key=` instead of `key=value`, as it is in my case. :)

I think that the reasoning with the reader maybe was that an empty string must be an empty python string. 
However there is no option to control how it gets written back to the output. One can of course walkaround it by replacing the '' values with '""', but I think the standard library is ought to be consistent, walkarounds are unpythonic, a raw parser should be transparent either way, and there should preferrably be one obvious way to do it.

I think this is not just unintuitive (especially in a parser called "raw"), but goes against the philosophy of "refusing the temptation to guess". 

As I know, the syntax of .ini files is not exactly well-defined, so the best option in my opinion would be allowing to configure the parser how to treat these values.

Whether or not adding this option is viable, I think the problem still remains that the writer now works inconsistently of the reader.
History
Date User Action Args
2013-10-31 17:24:06Nacsa.Kristófsetrecipients: + Nacsa.Kristóf
2013-10-31 17:24:06Nacsa.Kristófsetmessageid: <1383240246.91.0.876276014549.issue19461@psf.upfronthosting.co.za>
2013-10-31 17:24:06Nacsa.Kristóflinkissue19461 messages
2013-10-31 17:24:06Nacsa.Kristófcreate