Fix conversion of format strings with nested field references#252
Merged
ikamensh merged 1 commit intoikamensh:masterfrom Mar 27, 2026
Merged
Fix conversion of format strings with nested field references#252ikamensh merged 1 commit intoikamensh:masterfrom
ikamensh merged 1 commit intoikamensh:masterfrom
Conversation
ikamensh
approved these changes
Mar 27, 2026
Contributor
Author
|
Will fix lint issues. |
…at specs
'{0:>{1}}'.format(a, b) was incorrectly producing f'{a:>{{1}}}' (escaped
braces) instead of f'{a:>{b}}'. The format spec was treated as a literal
string, so nested field references like {1} were never resolved.
Parse the format spec for nested fields and build a proper JoinedStr AST
node with resolved references. This also enables converting the previously
skipped "{:{}}".format(x, y) case, as well as named, mixed implicit/explicit,
and multi-field nested specs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I first noted, while looking at flynting another project, that
is a pretty bad conversion.
I wrote a failing test case for that, and then asked Claude Code to fix it.
Turns out the same fix enabled, with a small tweak, conversion of the previously "too complex syntax".