Skip to content

Panic: entered unreachable code: t-string: unexpected token FStringMiddle #23198

@samuelcolvin

Description

@samuelcolvin

Summary

Running

let s = "A1[A\u{c}\0:+,>1t'{:f\0:{f\"f\0:\0{fm\0:{f:\u{10}\0\0\0:bb\0{@f>f\u{1}'\0f";
let _ = ruff_python_parser::parse_module(s);

is panicking with:

thread 'ruff_error' (266784) panicked at /Users/samuel/.cargo/git/checkouts/ruff-b18f69e2b025fac7/ce5f7b6/crates/ruff_python_parser/src/parser/expression.rs:1635:25:
internal error: entered unreachable code: t-string: unexpected token `FStringMiddle` at 31..41
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I'm using the latest release 0.15.0.

Found by fuzzing in pydantic/monty#119

Another similar failure here

Version

using tag 0.15.0

Metadata

Metadata

Assignees

No one assigned

    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