[issue23301] ConfigParser does not handle square brackets in section name

2015-01-22 Thread R. David Murray

R. David Murray added the comment:

This is a duplicate of issue 20923, which was rejected.  To argue against the 
rejection you probably need to provide evidence that this is something that is 
actually supported by other common ini parsers.  And that evidence should be 
posted to issue 20923.

--
nosy: +r.david.murray
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - ConfigParser should nested [] in section names.

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



[issue23301] ConfigParser does not handle square brackets in section name

2015-01-22 Thread Sebastian Bank

New submission from Sebastian Bank:

ConfigParser parses section lines containing square brackets like '[spam [eggs] 
spam]' up to the first instead of the last occurrence of ']' preventing 
roundtrips:

 s = StringIO()
 c1 = ConfigParser()
 c1.add_section('spam [eggs]')
 c1.write(s)
 s.seek(0)
 c2 = ConfigParser()
 c2.readfp(s)
 assert c1.sections() == c2.sections()  # fails

Potential fix: change the second line of SECTCRE from r'(?Pheader[^]]+)' to 
r'(?Pheader.+?)'.

If the parsing behaviour cannot be changed, the user should at least be warned 
about supplying data that breaks the roundtrip.

--
components: Library (Lib)
messages: 234497
nosy: xflr6
priority: normal
severity: normal
status: open
title: ConfigParser does not handle square brackets in section name
type: behavior
versions: Python 2.7, Python 3.4

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