Detect broken string templates that will raise ValueError when interpolated
Bug #950369 reported by
Jamu Kakar
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
For example, code like this will break:
>>> "%(foo)" % {"foo": "bar"}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: incomplete format
It'd be awesome if Pyflakes told me about that kind of issue.
summary: |
- It would be nice to detect string templates that will break when + Detect broken string templates that will raise ValueError when interpolated |
Changed in pyflakes: | |
importance: | Undecided → Wishlist |
status: | New → Triaged |
To post a comment you must log in.
I poked through the code and determined that implementing this kind of
check will be a pretty big pain in the neck. We'd need to parse the
string to determine what kind of interpolation is required and then
verify that with the arguments to be interpolated. ie, we'd need to
implement our own string interpolation engine. Ew.