]> 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:

Don't strip parens in assert / return with assign expr (#2143)
authorRichard Si <63936253+ichard26@users.noreply.github.com>
Mon, 26 Apr 2021 15:28:42 +0000 (11:28 -0400)
committerGitHub <noreply@github.com>
Mon, 26 Apr 2021 15:28:42 +0000 (08:28 -0700)
commitdb30456916ca733d011a2774e66beb3dd7064e14
tree16885a5e20f9e012441ed3d06b857c0a29373d88
parent0a833b4b14953f98e81d632281a75318faa66170
Don't strip parens in assert / return with assign expr (#2143)

Black would previously strip the parenthesis away from statements like this these ones:

    assert (spam := 12 + 1)
    return (cheese := 1 - 12)

Which happens to be invalid code. Now before making the parenthesis invisible, Black
checks if the assignment expression's parent is an assert stamtment, aborting if True.

Raise, yield, and await are already handled fine.

I added a bunch of test cases from the PEP defining asssignment expressions (PEP 572).
CHANGES.md
src/black/__init__.py
tests/data/pep_572_remove_parens.py