Ternary conditionals within F Strings Raise IndexError
Open
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
**Example:**
yapf_example.py contents:
```python yapf_example.py
print(f"This Fails, but is legal: {"Should be fine" if True else "But it's not"}")
```
**Running Yapf:**
`python -m yapf yapf_example.py`
**Result:**
```
...
return '{}:{}:{}: {}'.format(e.args[1][0], e.args[1][1], e.args[1][2], e.msg)
~~~~~~^^^
IndexError: tuple index out of range
```
**Yapf version**
0.40.2 (Latest at time of writing)
This might be related to [PEP 701](https://github.com/google/yapf/issues/1136), but if memory serves, this has been an issue since before 3.12.
Contributor guide
Assessment
This issue has not been assessed yet.