Groups
Groups
Sign in
Groups
Groups
iniparse-commits
Conversations
About
Send feedback
Help
Issue 30 in iniparse: Leading whitespace in front of a value make the parsing fail
0 views
Skip to first unread message
inip...@googlecode.com
unread,
Jun 13, 2012, 4:32:04 AM
6/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iniparse...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 30 by
batiste....@gmail.com
: Leading whitespace in front of a
value make the parsing fail
http://code.google.com/p/iniparse/issues/detail?id=30
What steps will reproduce the problem?
1. Create a ini file value with a leading white space
2. To access the value
The treatment of leading white spaces is not really well defined:
http://en.wikipedia.org/wiki/INI_file#Whitespace
The the doc definitely says that some implementation ignores them. In the
case of iniparse the name=value pair becomes completely unavailable.
I can't imagine a scenario where this could be desired.
The change might as simple as:
http://code.google.com/p/iniparse/source/browse/trunk/iniparse/ini.py#
line 131 in iniparse/ini.py
-name = m.group('name').rstrip()
+name = m.group('name').strip()
line 135 in iniparse/ini.py
-name = m.group('name').rstrip()
+name = m.group('name').strip()
Cheers,
Batiste
inip...@googlecode.com
unread,
Jun 13, 2012, 5:06:21 AM
6/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iniparse...@googlegroups.com
Comment #1 on issue 30 by
batiste....@gmail.com
: Leading whitespace in
front of a value make the parsing fail
http://code.google.com/p/iniparse/issues/detail?id=30
Here is a patch.
The tests seems to pass (I have the same number of failure). The only new
failure I couldn't fix is test_fuzz.test_fuzz test.
The fix makes options like the following valid:
;D/V{q]`9F!jh v]Y 7l={]HCA7L`nE)
The only problem here seem to be the leading spaces that are added in
good_lines. ConfigParser cannot handle.
I don't know how important it is for iniparse to mimic ConfigParser so I
let you decide what to do with this patch.
Attachments:
leading-whitespace.patch 2.1 KB
inip...@googlecode.com
unread,
Jun 17, 2012, 9:04:09 AM
6/17/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iniparse...@googlegroups.com
Comment #2 on issue 30 by
psobe...@gmail.com
: Leading whitespace in front
of a value make the parsing fail
http://code.google.com/p/iniparse/issues/detail?id=30
Older Pythons used to reject leading whitespace, but Python 3 seems to
accept them, so I think it's time for iniparse to accept them as well.
Reply all
Reply to author
Forward
0 new messages