Skip to content

Support 3.12 feature: PEP 701 – Syntactic formalization of f-strings #1136

Open
@Spitfire1900

Description

The following valid Python samples from https://peps.python.org/pep-0701/ running under 3.12.0rc1 will cause exceptions in YAPF.

  1. bag = {'wand': 'Elder'}
    print(f'Magic wand: { bag['wand'] }')
  2. source = 'a_file.py'
    print(f"{source.removesuffix(".py")}.c: $(srcdir)/{source}")
  3. print(f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}")
  4. print(f"{'':*^{1:{1:{1}}}}")
  5. x = 1
    y = 2
    print(
        f"___{
            x
        }___"
    )
    print(
        f"___{(
            y
        )}___"
    )
  6. my_dict = {"key": "value"}
    print(f" something { my_dict["key"] } something else ")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions