Repository navigation
Expose lexical bindings for unexecuted Python functions - #9
Merged
Merged
Conversation
This was referenced Nov 1, 2026
Open
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.
Parsing an uncalled Python function exposed an empty lexical scope through
NodeLibrary.getScope(node, null, ...). For example, neitherouternorinnerwas visible indef inspect(outer): inner = outer; return inner.Use the Bytecode DSL code unit's parameter/local, cell, and free-variable tables for null-frame scope enumeration. Exclude dot-prefixed compiler bindings such as
.0, and report values as unreadable and unwritable without a frame. Live-frame scope/value handling is preserved. Document why node entry versus exit does not change Python function lexical membership.The regression instrument registers a source-section listener before parsing, which exposes nested uncalled roots without executing the module. It covers all four existing instrumentation-option combinations, closures and captured parameters, global/nonlocal declarations, names before assignment, generators, async functions, class closures, Unicode identifiers, hidden comprehension arguments, source locations, both nodeEnter values, and changed contents at the same URI.
Validation on macOS/AArch64:
mx --java-home=lookup:default --suitemodel nested python-jvmpassed.mx --java-home=lookup:default --suitemodel nested unittest LexicalScopeTests PythonDebugTestpassed: 16 tests.Integration note: a one-shot source-section visit after parsing saw only the module in the initial probe. Register the load listener before parsing, as in the regression instrument. This change does not add a static-analysis service or promise complete module/class namespace metadata. Native Image and Elide's probe against a newly published artifact remain follow-up validation.
Patch tracking: elide-dev/graal#3.