summaryrefslogtreecommitdiffstats
path: root/Lib/ConfigParser.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-09-27 16:21:18 (GMT)
committerFred Drake <fdrake@acm.org>2002-09-27 16:21:18 (GMT)
commit176916a98928c1828acd997f5bc11863f0d36c71 (patch)
treeea7ae810fcc5a8e05aa1f3cca2a2ce14852a7fe4 /Lib/ConfigParser.py
parent2ca041fde0e20077b1a2bdb33a54db4c3badf38a (diff)
downloadcpython-176916a98928c1828acd997f5bc11863f0d36c71.zip
cpython-176916a98928c1828acd997f5bc11863f0d36c71.tar.gz
cpython-176916a98928c1828acd997f5bc11863f0d36c71.tar.bz2
Allow internal whitespace in keys.
Closes SF bug #583248; backporting to r22-maint branch.
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r--Lib/ConfigParser.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index 47243fb..842a576 100644
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -418,7 +418,7 @@ class ConfigParser:
r'\]' # ]
)
OPTCRE = re.compile(
- r'(?P<option>[^:=\s]+)' # very permissive!
+ r'(?P<option>[^:=\s][^:=]*)' # very permissive!
r'\s*(?P<vi>[:=])\s*' # any number of space/tab,
# followed by separator
# (either : or =), followed
@@ -448,7 +448,8 @@ class ConfigParser:
# comment or blank line?
if line.strip() == '' or line[0] in '#;':
continue
- if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR": # no leading whitespace
+ if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
+ # no leading whitespace
continue
# continuation line?
if line[0].isspace() and cursect is not None and optname:
@@ -488,7 +489,7 @@ class ConfigParser:
# allow empty values
if optval == '""':
optval = ''
- optname = self.optionxform(optname)
+ optname = self.optionxform(optname.rstrip())
cursect[optname] = optval
else:
# a non-fatal parsing error occurred. set up the