[issue21498] configparser accepts keys beginning with comment_chars when writing

2020-01-11 Thread Batuhan


Batuhan  added the comment:

Any update on this? Discussion over Python-Dev looks like finished without a 
consensus/resolution.

--
nosy: +BTaskaya

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21498] configparser accepts keys beginning with comment_chars when writing

2014-05-26 Thread Łukasz Langa

Changes by Łukasz Langa :


--
assignee:  -> lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21498] configparser accepts keys beginning with comment_chars when writing

2014-05-13 Thread Florian Bruhin

New submission from Florian Bruhin:

When adding something to a configparser instance which has a key beginning with 
a comment char, it writes the data to a file without generating an error, and 
when reading the file back obviously the data is different as it's a comment:

>>> cp = configparser.ConfigParser()
>>> cp.read_dict({'DEFAULT': {';foo': 'bar'}})
>>> cp.write(sys.stdout)
[DEFAULT]
;foo = bar

This was discussed on python-dev here:
https://mail.python.org/pipermail/python-dev/2014-April/134293.html

Of course there are other corner cases as well, like having a key like "[foo]" 
or "=bar".

I think whatever data I pass into a configparser should also come out again 
when reading the file back.

Since there's no escaping in configparser, I think the ideal solution would be 
configparser refusing to write ambigious values.

While this is technically a backwards-incompatible change, applications doing 
this were broken in the first place, so validation while writing will not break 
anything.

Validating when setting values would be better of course, but this can 
potentially break applications where configparser is used without actually 
writing a file.

--
components: Library (Lib)
messages: 218463
nosy: The Compiler, lukasz.langa
priority: normal
severity: normal
status: open
title: configparser accepts keys beginning with comment_chars when writing
type: behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com