We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 30d454d commit d30b2b5Copy full SHA for d30b2b5
mypy/checkstrformat.py
@@ -1008,11 +1008,11 @@ def check_expr(expr: Expression) -> None:
1008
self.msg.requires_int_or_single_byte(context)
1009
else:
1010
if isinstance(folded := constant_fold_expr(expr, "unused"), str):
1011
- value = folded
+ if len(folded) != 1:
1012
+ self.msg.requires_int_or_char(context)
1013
elif isinstance(expr, BytesExpr):
- value = expr.value
1014
- if len(value) != 1:
1015
- self.msg.requires_int_or_char(context)
+ if len(expr.value) != 1:
1016
1017
return check_expr, check_type
1018
0 commit comments