summaryrefslogtreecommitdiff
path: root/pylint/config/find_default_config_files.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-30 13:50:06 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-03-31 12:34:05 +0200
commitbb84699b4d6925485f0e2e06eef0d7c052c67d67 (patch)
treebcfe407c5b13c65cf0c4722cd733a1ab642954a7 /pylint/config/find_default_config_files.py
parent592f133f8d9f2d62b6f72e26de0c62b0e8636274 (diff)
downloadpylint-git-bb84699b4d6925485f0e2e06eef0d7c052c67d67.tar.gz
Handle invalid .cfg when assessing if they contain a pylint config
Diffstat (limited to 'pylint/config/find_default_config_files.py')
-rw-r--r--pylint/config/find_default_config_files.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py
index 82c343a49..70e867ad6 100644
--- a/pylint/config/find_default_config_files.py
+++ b/pylint/config/find_default_config_files.py
@@ -27,7 +27,10 @@ def _toml_has_config(path: Union[Path, str]) -> bool:
def _cfg_has_config(path: Union[Path, str]) -> bool:
parser = configparser.ConfigParser()
- parser.read(path, encoding="utf-8")
+ try:
+ parser.read(path, encoding="utf-8")
+ except configparser.Error:
+ return False
return any(section.startswith("pylint.") for section in parser.sections())