mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-02 09:52:18 +00:00
Fix formatter panic with comment after parenthesized dict value (#5293)
## Summary
This snippet used to panic because it expected to see a comma or
something similar after the `2` but met the closing parentheses that is
not part of the range and panicked
```python
a = {
1: (2),
# comment
3: True,
}
```
Originally found in
636a717ef0/testing/marionette/client/marionette_driver/geckoinstance.py (L109)
This snippet is also the test plan.
This commit is contained in:
parent
f7e1cf4b51
commit
d407165aa7
3 changed files with 40 additions and 8 deletions
|
@ -48,3 +48,11 @@ mapping = {
|
|||
C: 0.1 * (10.0 / 12),
|
||||
D: 0.1 * (10.0 / 12),
|
||||
}
|
||||
|
||||
# Regression test for formatter panic with comment after parenthesized dict value
|
||||
# Originally found in https://github.com/bolucat/Firefox/blob/636a717ef025c16434997dc89e42351ef740ee6b/testing/marionette/client/marionette_driver/geckoinstance.py#L109
|
||||
a = {
|
||||
1: (2),
|
||||
# comment
|
||||
3: True,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue