diff --git a/src/black/files.py b/src/black/files.py index 4d7b47aaa9f..eb4a94a5e60 100644 --- a/src/black/files.py +++ b/src/black/files.py @@ -93,8 +93,8 @@ def parse_pyproject_toml(path_config: str) -> Dict[str, Any]: If parsing fails, will raise a tomli.TOMLDecodeError """ - with open(path_config, encoding="utf8") as f: - pyproject_toml = tomli.load(f) # type: ignore # due to deprecated API usage + with open(path_config, "rb") as f: + pyproject_toml = tomli.load(f) config = pyproject_toml.get("tool", {}).get("black", {}) return {k.replace("--", "").replace("-", "_"): v for k, v in config.items()}