Repository navigation
Conversation
gpshead
marked this pull request as ready for review
October 22, 2026 04:18
…ists Converting a nested list or tuple to a Tcl object now raises ValueError above 1000 levels, the same limit _flatten() uses. Converting a deeply nested Tcl list back to Python now raises RecursionError.
gpshead
force-pushed
the
tkinter-asobj-recursion
branch
from
October 22, 2026 04:44
da7f96a to
2861120
Compare
| Py_DECREF(result); | ||
| return Tkinter_Error(tkapp); | ||
| } | ||
| if (Py_EnterRecursiveCall(" while converting a Tcl list")) { |
Member
There was a problem hiding this comment.
This enters and leaves the recursion guard for every element of the list. It would be cheaper to do this once for list.
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.
Pass a depth through
AsObj()/TupleAsObj()and raiseValueErrorabove 1000 levels, the same limit and exception_flatten()uses. A fixed limit rather than a C stack check, because Tcl itself recurses when it builds the string form of a nested list and can overflow at depths Python's stack check would still allow. Converted items are now released on the error path instead of leaked. The reverse direction,FromObj()on a nested Tcl list, getsPy_EnterRecursiveCall()and raisesRecursionError.Lists or tuples nested deeper than 1000 levels that happened to fit on the stack used to convert and now raise
ValueError.Fixes #160176
ANT-2026-7UKC5QED