Mercurial > cpython-lru_cache-weakref
diff Lib/ConfigParser.py @ 25463:1d91edfd75f2 2.2
Allow internal whitespace in keys.
Closes SF bug #583248.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Fri, 27 Sep 2002 16:34:30 +0000 |
| parents | 05ffe201e902 |
| children | 2dc0da5372b4 |
line wrap: on
line diff
--- a/Lib/ConfigParser.py Fri Sep 27 08:51:20 2002 +0000 +++ b/Lib/ConfigParser.py Fri Sep 27 16:34:30 2002 +0000 @@ -385,7 +385,7 @@ 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 @@ -415,7 +415,8 @@ # 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: @@ -455,7 +456,7 @@ # 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
