]> git.madduck.net Git - etc/vim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Disable universal newlines when reading TOML (#2408)
authorTaneli Hukkinen <3275109+hukkin@users.noreply.github.com>
Tue, 21 Dec 2021 16:03:07 +0000 (18:03 +0200)
committerGitHub <noreply@github.com>
Tue, 21 Dec 2021 16:03:07 +0000 (08:03 -0800)
CHANGES.md
Pipfile
setup.py
src/black/files.py

index 0452f1820c4c139313b911ee205a05c53b6fa09c..252f2cc886389a6d52c841679e7592a60001c490 100644 (file)
@@ -4,6 +4,7 @@
 
 ### _Black_
 
+- Do not accept bare carriage return line endings in pyproject.toml (#2408)
 - Improve error message for invalid regular expression (#2678)
 - Improve error message when parsing fails during AST safety check by embedding the
   underlying SyntaxError (#2693)
diff --git a/Pipfile b/Pipfile
index a3af5fd8844641b3fe1fd66a55f14d8a7da750dd..90d4a2a78c1d24fc18c09a1b0714a465ea47b499 100644 (file)
--- a/Pipfile
+++ b/Pipfile
@@ -42,7 +42,7 @@ platformdirs= ">=2"
 click = ">=8.0.0"
 mypy_extensions = ">=0.4.3"
 pathspec = ">=0.8.1"
-tomli = ">=0.2.6, <2.0.0"
+tomli = ">=1.1.0, <3.0.0"
 typed-ast = "==1.4.3"
 typing_extensions = {markers = "python_version < '3.10'", version = ">=3.10.0.0"}
 black = {editable = true,extras = ["d"],path = "."}
index a21bc87264ddce52b795b7e972a47e11380a413a..d314bb283f226bbd3fecdbc6a6e20cd3996edd55 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -99,7 +99,7 @@ setup(
     install_requires=[
         "click>=7.1.2",
         "platformdirs>=2",
-        "tomli>=0.2.6,<2.0.0",
+        "tomli>=1.1.0,<3.0.0",
         "typed-ast>=1.4.2; python_version < '3.8' and implementation_name == 'cpython'",
         "pathspec>=0.9.0, <1",
         "dataclasses>=0.6; python_version < '3.7'",
index 560aa05080da9136beca90109247088e0d8dd67c..dfab9f7303962931b729de9bcaf38fd2e20066f2 100644 (file)
@@ -95,8 +95,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.loads(f.read())
+    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()}