From ac02be7686bd928729f843e08421fb63e1c38d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Sat, 10 Apr 2021 14:29:08 +0200 Subject: [PATCH] Force encoding in reading of setup.cfg to utf-8 (#4329) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add Sebastian Müller to contributors * Add setup.cfg utf8 fix to changelog Co-authored-by: Pierre Sassoulas --- CONTRIBUTORS.txt | 2 ++ ChangeLog | 4 ++++ pylint/config/find_default_config_files.py | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index c6162a235..e95ae4529 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -468,3 +468,5 @@ contributors: * James Sinclair (irgeek): contributor * Andreas Finkler: contributor + +* Sebastian Müller: contributor diff --git a/ChangeLog b/ChangeLog index c6e3068f0..808d31f5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -67,6 +67,10 @@ Release date: Undefined * Don't show ``DuplicateBasesError`` for attribute access +* Fix crash when checking ``setup.cfg`` for pylint config when there are non-ascii characters in there + + Closes #4328 + * Allow code flanked in backticks to be skipped by spellchecker Closes #4319 diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py index 126ac4a1e..b1457a892 100644 --- a/pylint/config/find_default_config_files.py +++ b/pylint/config/find_default_config_files.py @@ -26,7 +26,7 @@ def _toml_has_config(path): def _cfg_has_config(path): parser = configparser.ConfigParser() - parser.read(path) + parser.read(path, encoding="utf-8") return any(section.startswith("pylint.") for section in parser.sections())