Skip to content

Commit 6548995

Browse files
Update checkstrformat.py
1 parent cb38f60 commit 6548995

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

mypy/checkstrformat.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,13 +1006,12 @@ def check_expr(expr: Expression) -> None:
10061006
and len(expr.value) != 1
10071007
):
10081008
self.msg.requires_int_or_single_byte(context)
1009-
else:
1010-
if isinstance(folded := constant_fold_expr(expr, "<unused>"), str):
1011-
if len(folded) != 1:
1012-
self.msg.requires_int_or_char(context)
1013-
elif isinstance(expr, BytesExpr):
1014-
if len(expr.value) != 1:
1015-
self.msg.requires_int_or_char(context)
1009+
elif isinstance(folded := constant_fold_expr(expr, "<unused>"), str):
1010+
if len(folded) != 1:
1011+
self.msg.requires_int_or_char(context)
1012+
elif isinstance(expr, BytesExpr):
1013+
if len(expr.value) != 1:
1014+
self.msg.requires_int_or_char(context)
10161015

10171016
return check_expr, check_type
10181017

0 commit comments

Comments
 (0)