Skip to content

Commit 9b1c637

Browse files
Ignore ill-formed INI files instead of crashing
1 parent eb4a58f commit 9b1c637

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

codespell_lib/_codespell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,10 @@ def parse_options(
581581
used_cfg_files = []
582582
for cfg_file in cfg_files:
583583
_cfg = configparser.ConfigParser()
584-
_cfg.read(cfg_file)
584+
try:
585+
_cfg.read(cfg_file)
586+
except configparser.Error as e:
587+
continue # ignore unparsable config file!
585588
if _cfg.has_section("codespell"):
586589
used_cfg_files.append(cfg_file)
587590

0 commit comments

Comments
 (0)