-
- Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
3.11:
>>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Constant(value='"'), FormattedValue( value=Name(id='var', ctx=Load()), conversion=-1, format_spec=JoinedStr(values=[])), Constant(value='"')]))], type_ignores=[])3.12:
>>> import ast >>> print(ast.dump(ast.parse("""f'"{var:}"'"""), indent=2)) Module( body=[ Expr( value=JoinedStr( values=[ Constant(value='"'), FormattedValue( value=Name(id='var', ctx=Load()), conversion=-1, format_spec=JoinedStr( values=[ Constant(value='')])), Constant(value='"')]))], type_ignores=[])This affects several linters:
- Fix parse test case on Python 3.12 mypy#15577
- B907 crashes when bugbear is run on Python 3.12 PyCQA/flake8-bugbear#393
Is this a bug? Or is it a feature?
Linked PRs
sunmy2019
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error