Skip to content

[3.13.0b4] f-string with precision specifier has format_spec of Constant, not JoinedStr #122300

Closed
@jacobtylerwalls

Description

@jacobtylerwalls

Bug report

Bug description:

Python 3.12.0 (v3.12.0:0fb18b02c8, Oct  2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
>>> import ast
>>> ast.parse("f'{e:.3}'").body[0].value.values[0].format_spec
<ast.JoinedStr object at 0x1002aa050>
Python 3.13.0b4 (v3.13.0b4:567c38b4eb, Jul 18 2024, 07:28:29) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
>>> import ast
>>> ast.parse("f'{e:.3}'").body[0].value.values[0].format_spec
<ast.Constant object at 0x104af45d0>

Docs say FormattedValue.format_spec is a JoinedStr.

Reported downstream in pylint-dev/astroid#2478

Not present in 3.13.0b3

CPython versions tested on:

3.13

Operating systems tested on:

Linux, macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions