X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/14d84ba2e96c5ca1351b8fe4d0d415cc148f4117..e9681a40dcb3d38b56b301d811bb1c55201fd97e:/src/black/linegen.py?ds=inline diff --git a/src/black/linegen.py b/src/black/linegen.py index 9c85e76..8a28c39 100644 --- a/src/black/linegen.py +++ b/src/black/linegen.py @@ -318,7 +318,12 @@ class LineGenerator(Visitor[Line]): self.visit_try_stmt = partial( v, keywords={"try", "except", "else", "finally"}, parens=Ø ) - self.visit_except_clause = partial(v, keywords={"except"}, parens=Ø) + if self.mode.preview: + self.visit_except_clause = partial( + v, keywords={"except"}, parens={"except"} + ) + else: + self.visit_except_clause = partial(v, keywords={"except"}, parens=Ø) self.visit_with_stmt = partial(v, keywords={"with"}, parens=Ø) self.visit_funcdef = partial(v, keywords={"def"}, parens=Ø) self.visit_classdef = partial(v, keywords={"class"}, parens=Ø)