summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Lib/configparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Lib/configparser.py')
-rw-r--r--contrib/tools/python3/Lib/configparser.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/tools/python3/Lib/configparser.py b/contrib/tools/python3/Lib/configparser.py
index 05b86acb919..3968ac45eed 100644
--- a/contrib/tools/python3/Lib/configparser.py
+++ b/contrib/tools/python3/Lib/configparser.py
@@ -316,12 +316,15 @@ class ParsingError(Error):
def append(self, lineno, line):
self.errors.append((lineno, line))
- self.message += '\n\t[line %2d]: %s' % (lineno, repr(line))
+ self.message += f'\n\t[line {lineno:2d}]: {line!r}'
def combine(self, others):
+ messages = [self.message]
for other in others:
- for error in other.errors:
- self.append(*error)
+ for lineno, line in other.errors:
+ self.errors.append((lineno, line))
+ messages.append(f'\n\t[line {lineno:2d}]: {line!r}')
+ self.message = "".join(messages)
return self
@staticmethod
@@ -597,7 +600,9 @@ class RawConfigParser(MutableMapping):
\] # ]
"""
_OPT_TMPL = r"""
- (?P<option>.*?) # very permissive!
+ (?P<option> # very permissive!
+ (?:(?!{delim})\S)* # non-delimiter non-whitespace
+ (?:\s+(?:(?!{delim})\S)+)*) # optionally more words
\s*(?P<vi>{delim})\s* # any number of space/tab,
# followed by any of the
# allowed delimiters,
@@ -605,7 +610,9 @@ class RawConfigParser(MutableMapping):
(?P<value>.*)$ # everything up to eol
"""
_OPT_NV_TMPL = r"""
- (?P<option>.*?) # very permissive!
+ (?P<option> # very permissive!
+ (?:(?!{delim})\S)* # non-delimiter non-whitespace
+ (?:\s+(?:(?!{delim})\S)+)*) # optionally more words
\s*(?: # any number of space/tab,
(?P<vi>{delim})\s* # optionally followed by
# any of the allowed