Skip to content

Commit

Permalink
Model comment prefixes in the RawConfigParser within a prefixes names…
Browse files Browse the repository at this point in the history
…pace.
  • Loading branch information
jaraco committed Mar 29, 2024
1 parent 7d807bb commit 29cb20f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Lib/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,10 @@ def __init__(self, defaults=None, dict_type=_default_dict,
else:
self._optcre = re.compile(self._OPT_TMPL.format(delim=d),
re.VERBOSE)
self._comment_prefixes = tuple(comment_prefixes or ())
self._inline_comment_prefixes = tuple(inline_comment_prefixes or ())
self._prefixes = _Prefixes(
full=tuple(comment_prefixes or ()),
inline=tuple(inline_comment_prefixes or ()),
)
self._strict = strict
self._allow_no_value = allow_no_value
self._empty_lines_in_values = empty_lines_in_values
Expand Down Expand Up @@ -1057,10 +1059,7 @@ def _read(self, fp, fpname):
def _read_inner(self, fp, fpname):
st = _ReadState()

Line = functools.partial(
_Line,
prefixes=_Prefixes(full=self._comment_prefixes, inline=self._inline_comment_prefixes),
)
Line = functools.partial(_Line, prefixes=self._prefixes)
for st.lineno, line in enumerate(map(Line, fp), start=1):
if not line.clean:
if self._empty_lines_in_values:
Expand Down

0 comments on commit 29cb20f

Please sign in to comment.