Repository navigation
Fix tool validation for unpacking aliases in with statements - #2949
Draft
yashwant938 wants to merge 1 commit into
Draft
yashwant938 wants to merge 1 commit into
yashwant938 wants to merge 1 commit into
Conversation
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.
Tools using
with context() as (left, right)execute successfully but fail export becauseMethodChecker.visit_Withdoes not register unpacked aliases. Collectast.Namenodes withast.Storecontext from the alias subtree so tuple, list, nested, and starred bindings are recognized. Referenced names in attribute and subscript targets remain subject to undefined-name checks.Fixes #2942.
This is a draft pending maintainer acceptance of the issue (
status:acceptedand assignment) and contributor review. Could a maintainer confirm whether this focused change is in scope?Regression coverage includes ordinary aliases, unpacking aliases, multiple context managers, undefined names, and export/reload of both decorated tools and
Toolsubclasses.Validation
Ubuntu under WSL, Python 3.14.4, based on
96f33faaf028479119ec8d34507b47694cf14e34:leftandright; the validator suite with the added regression cases reports 7 failed and 21 passed.pytest tests/test_tool_validation.py tests/test_tools.py::TestTool tests/test_tools.py::TestToolDecorator -q -o addopts= --tb=short: 70 passed, including 12 new regression cases.make quality: lint passed and all 77 checked files were already formatted.git diff --check: passed.The full project suite and the CI Python 3.10/3.12 matrix were not run locally.
AI assistance
OpenAI Codex assisted with implementation, regression tests, local test execution, and PR preparation. This remains a draft pending contributor review of the change and verification results.