Skip to content

Invalid f-string conversion type code parses/passes #18671

@MeGaGiGaGon

Description

@MeGaGiGaGon

Summary

It feels like this code should be rejected, or there should be some sort of lint for this. All three of these f-strings are invalid

f"{1!
r}"
f"{1! r}"
f"{1!\
r}"

And raise SyntaxError: f-string: conversion type must come right after the exclamanation mark, but it parses/formats with no complaints, even with all lints enabled playground link
(Also I already make a PR in CPython for the typo in the error)

Version

playground

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingparserRelated to the parser

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions