Repository navigation
Fix #13674: do not evaluate @property getters during Jedi completion - #15476
Open
zheng-guannan577 wants to merge 2 commits into
Open
zheng-guannan577 wants to merge 2 commits into
zheng-guannan577 wants to merge 2 commits into
Conversation
🤖🤖 AI 辅助起草 — This contribution was drafted with AI assistance; the analysis, the change and the tests are described above so that they can be reviewed.
🤖🤖 AI 辅助起草 — This contribution was drafted with AI assistance; the analysis, the change and the tests are described above so that they can be reviewed.
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.
Fixes #13674
Problem
Completing attributes of a @Property value (e.g.
f.yo.<tab>) made Jedi evaluate the getter at runtime for live namespace objects, bypassing the completer's evaluation policy (the non-Jedi path already refuses the access underlimited).Note: the exact
f.<tab>repro from 2022 is already fixed on main by the guarded-eval machinery; this PR fixes the remaining live instance,f.yo.<tab>via Jedi.Fix
IPCompleter._jedi_matchesnow skips Jedi when the attribute chain before the cursor ends in a property on a live namespace object, detected withinspect.getattr_staticso the check itself never invokes the getter.cached_propertyis covered the same way (unless already cached). Underunsafe/dangerousevaluation the getter is still allowed, matching the non-Jedi matchers.Tests
test_jedi_does_not_evaluate_property—f.listsyowithout calling the getter;f.yo.gives no completions underlimitedand int completions underunsafe.🤖🤖 AI 辅助起草 — This contribution was drafted with AI assistance; the analysis, the change and the tests are described above so that they can be reviewed.