Skip to content

[Linter panic] RUF027 preview rule can cause linter panic on specific string #21538

@skraeven

Description

@skraeven

Ruff has crashed while running on our code base, due to a specific string/rule combination.

Given this (minimal repro version) string in a python file:

foo = "{'bar': {\t'"

Running ruff check . --preview --select=RUF027 --isolated will cause linter panic.

Playground: https://play.ruff.rs/486e305d-99f7-4dcb-88fb-60d8fe45f002

Here's RUST_BACKTRACE=1 output:

info: Backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>
  24: <unknown>
  25: <unknown>
  26: <unknown>
  27: start_thread
             at ./nptl/pthread_create.c:447:8
  28: clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0

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