Skip to content

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Mar 3, 2025

Summary

This is a follow-up to #16446 to fix the diagnostic range to point to the * like pyright does (#16446 (comment)).

Storing the range in the ExceptClauseKind::Star variant feels slightly awkward, but we don't store the star itself anywhere on the ExceptHandler. And we can't just take ExceptHandler.start() + "except".text_len() because this code appears to be valid:

try: ...
except    *    Error: ...

Test Plan

Existing tests.

Summary
--
This is a follow-up to #16446 to fix the diagnostic range.

Storing the range in the `ExceptClauseKind::Star` variant feels slightly
awkward, but we don't store the star itself anywhere on the `ExceptHandler`.
And we can't just take `ExceptHandler.start() + "except".text_len()` because
this code appears to be valid:

```python
try: ...
except    *    Error: ...
```

Test Plan
--
Existing tests.
@ntBre ntBre added parser Related to the parser preview Related to preview mode features labels Mar 3, 2025
Copy link
Contributor

github-actions bot commented Mar 3, 2025

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.

@ntBre ntBre enabled auto-merge (squash) March 4, 2025 16:46
@ntBre ntBre merged commit c8a06a9 into main Mar 4, 2025
20 checks passed
@ntBre ntBre deleted the brent/except-star-range branch March 4, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Related to the parser preview Related to preview mode features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants