Verify autoformatter recursion limit fix (already resolved upstream)#103
Closed
Verify autoformatter recursion limit fix (already resolved upstream)#103
Conversation
Copilot
AI
changed the title
[WIP] Fix autoformatter recursion limit for struct and enum fields
Verify autoformatter recursion limit fix (already resolved upstream)
Dec 6, 2025
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.
The autoformatter was hitting Python's recursion limit on
structs/enums with many fields/entries. The compiler front end was previously fixed, but the formatter was not.Status: Already Fixed
This issue was resolved upstream in google/emboss PR google#215 (Dec 2024). The fix is already present in this fork.
Implementation
compiler/util/parser_util.py- New iterativetransform_parse_tree()using explicit stack instead of recursioncompiler/front_end/format_emb.py- Updated to useparser_util.transform_parse_treecompiler/front_end/module_ir.py- Updated to useparser_util.transform_parse_treeThe iterative approach eliminates the recursion limit entirely (up to available memory):
Verification
Tests pass with 32k+ entity files (2x the Python default recursion limit):
FormatEmbTest.test_very_long_emb✓ModuleIrTest.test_long_input✓No code changes needed—closing as resolved.
Original prompt
structs/enums with many fields/entries #84✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.