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

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:

Stop changing return type annotations to tuples (#2384)
authorRichard Si <63936253+ichard26@users.noreply.github.com>
Thu, 26 Aug 2021 01:32:27 +0000 (21:32 -0400)
committerGitHub <noreply@github.com>
Thu, 26 Aug 2021 01:32:27 +0000 (18:32 -0700)
commit8a59528c2d8ae1ef5f366039c728614aaf1a470b
tree9e08cd04eb83f31f7a621dfd43641a7791dd1bad
parentd249f2d8380893f051b63140e3768cef599f49f3
Stop changing return type annotations to tuples (#2384)

This fixes a bug where a trailing comma would be added to a
parenthesized return annotation changing its type to a tuple.
Here's one case where this bug shows up:

```
def spam() -> (
    this_is_a_long_type_annotation_which_should_NOT_get_a_trailing_comma
):
    pass
```

The root problem was that the type annotation was treated as if it was
a parameter & import list (is_body=True to linegen::bracket_split_build_line)
where a trailing comma is usually fine. Now there's another check in the
aforementioned function to make sure the body it's operating on isn't
a return annotation before truly adding a trailing comma.
CHANGES.md
src/black/linegen.py
src/black/nodes.py
tests/data/function_trailing_comma.py