X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/898915d5569f503c278ef53cb6f10e003034943c..4e93f2aa01606154dc6af6e494b9f2b7e4c8c7fa:/src/blackd/__init__.py?ds=sidebyside diff --git a/src/blackd/__init__.py b/src/blackd/__init__.py index c1b69fe..6b0f3d3 100644 --- a/src/blackd/__init__.py +++ b/src/blackd/__init__.py @@ -152,7 +152,8 @@ async def handle(request: web.Request, executor: Executor) -> web.Response: ) # Preserve CRLF line endings - if req_str[req_str.find("\n") - 1] == "\r": + nl = req_str.find("\n") + if nl > 0 and req_str[nl - 1] == "\r": formatted_str = formatted_str.replace("\n", "\r\n") # If, after swapping line endings, nothing changed, then say so if formatted_str == req_str: @@ -225,7 +226,6 @@ def parse_python_variant_header(value: str) -> Tuple[bool, Set[black.TargetVersi def patched_main() -> None: maybe_install_uvloop() freeze_support() - black.patch_click() main()