Bug report
Bug description:
Should the code below produce an error?
This produces '2' in Python 3.14.5 on MacOS.
Reading
https://docs.python.org/3/library/string.html#format-string-syntax
replacement_field: "{" [field_name] ["!" conversion] [":" format_spec] "}"
field_name: arg_name ("." attribute_name | "[" element_index "]")*
arg_name: [identifier | digit+]
this ends up pointing to identifier at https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-identifier
NAME: name_start name_continue*
name_start: "a"..."z" | "A"..."Z" | "_" | <non-ASCII character>
name_continue: name_start | "0"..."9"
identifier: <NAME, except keywords>
Given that '(' is an Ascii character, then ( is not a valid identifier and it should not be allowed.
CPython versions tested on:
3.14
Operating systems tested on:
macOS
Bug report
Bug description:
Should the code below produce an error?
This produces
'2'in Python 3.14.5 on MacOS.Reading
https://docs.python.org/3/library/string.html#format-string-syntax
this ends up pointing to
identifierat https://docs.python.org/3/reference/lexical_analysis.html#grammar-token-python-grammar-identifierGiven that
'('is an Ascii character, then(is not a valid identifier and it should not be allowed.CPython versions tested on:
3.14
Operating systems tested on:
macOS