Describe the bug
black --preview crashed on some code.
To Reproduce
For example, take this code:
v = {
('a_very_long_str_a_very_long_str_a_very_long_str_a_very_long_str_'
'a_very_long_str_a_very_long_str_a_very_long_str_'): {
'key':
'value',
},
}
And run it with these arguments:
$ black file.py --preview
The resulting error is:
error: cannot format /Users/yileiyang/Downloads/t.py: Cannot parse: 3:122: "a_very_long_str_a_very_long_str_a_very_long_str_a_very_long_str_a_very_long_str_a_very_long_str_a_very_long_str_": {
Oh no! 💥 💔 💥
1 file failed to reformat.
Expected behavior
Should not crash.
Environment
- Black's version:
22.8.1.dev4+g383b228
- OS and Python version: macOS, Python 3.9.12
Additional context
Looks like this was caused by #3162, I'll take a look.
Describe the bug
black --previewcrashed on some code.To Reproduce
For example, take this code:
And run it with these arguments:
The resulting error is:
Expected behavior
Should not crash.
Environment
22.8.1.dev4+g383b228Additional context
Looks like this was caused by #3162, I'll take a look.