Skip to content

Accept a bare raise before a semicolon - #29761

Merged
charliermarsh merged 1 commit into
mainfrom
fix/parse-semicolon-statements
Oct 27, 2026
Merged

charliermarsh merged 1 commit into
mainfrom
fix/parse-semicolon-statements

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Summary

A bare raise can end at a semicolon. For example, Python accepts this handler and re-raises the current exception.

try:
    work()
except ValueError:
    raise; report()

The parser tried to read the semicolon as the start of an exception expression and reported a syntax error. We now recognize both a newline and a semicolon as terminators for a bare raise.

@charliermarsh charliermarsh added bug An issue describing something that isn't working, or a PR that fixes a bug parser Related to the parser labels Oct 27, 2026
@astral-automations-bot

Copy link
Copy Markdown
Contributor

Memory usage report

Memory usage unchanged βœ…


Results for 8d206dc Β· Workflow run

@astral-automations-bot

Copy link
Copy Markdown
Contributor

ecosystem-analyzer results

No diagnostic changes detected βœ…

Full report with detailed diff Β· Timing results


Results for 8d206dc Β· Workflow run

@astral-automations-bot

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

βœ… ecosystem check detected no linter changes.

Linter (preview)

βœ… ecosystem check detected no linter changes.

Formatter (stable)

βœ… ecosystem check detected no format changes.

Formatter (preview)

βœ… ecosystem check detected no format changes.


Results for 8d206dc Β· Workflow run

@charliermarsh
charliermarsh merged commit abee0da into main Oct 27, 2026
78 of 79 checks passed
@charliermarsh
charliermarsh deleted the fix/parse-semicolon-statements branch October 27, 2026 16:18

This branch was previously deployed

1 inactive deployment
automations β€” 8d206dca Deployed Oct 27, 2026 by charliermarsh via security-review / security review #95923
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug parser Related to the parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants