Repository navigation
Fix recursion depth failure in string transformation reconstruction - #15680
Open
hulei22103-gif wants to merge 1 commit into
Open
hulei22103-gif wants to merge 1 commit into
hulei22103-gif wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Describe your change
assemble_transformation()uses one recursive call per edit operation. Converting an empty string to"ab" * 1100builds its operation table successfully, but reconstructing the 2,200 insertions raisesRecursionErrorwith the default recursion limit of 1,000. The deletion-only case fails in the same way.Walk the same predecessor cells iteratively, collect operations in reverse order, and reverse the result once at the end. This preserves the existing path and operation order without using a Python call stack proportional to the number of edits. The dynamic programming cost calculation is unchanged.
Reproduction, from the repository root:
Validation on Windows with Python 3.15.2 free-threading build:
scripts/validate_filenames.pydirectly with Python 3.15t passed.uv-lockwas skipped because dependencies and the lockfile are unchanged.Full repository tests and remote CI have not been run locally. This fixes reconstruction stack usage; the cost-table algorithm still requires O(m*n) time and space. Malformed operation tables are outside this change.
AI assistance: OpenAI Codex helped identify and implement this change, run local validation, and prepare this pull request. Human review and understanding of the patch remain necessary.
Checklist
The authorship checkbox is left unchecked because this is an AI-assisted contribution, as disclosed above.