Skip to content

E703: Incorrect detection and replacement of semicolon #4828

@addisoncrump

Description

@addisoncrump

Okay, I'll be the first to say it, but this bug is really not that important. I'm reporting it primarily because it implies that there may be other issues with semicolon/newline processing in other situations I haven't observed yet.

The following snippet is a valid Python script (no trailing newline):

0\
;

Ruff attempts to correct it to the following (with trailing newline, but it's escaped):

0\

As a result, there is an EOF syntax error. This only applies to a situation where a) there is a semicolon at the end of the input (no trailing newline), and b) the line before is escaped.

Discovered with #4822.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions