Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-113978: Ignore warnings on text completion inside REPL#113979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
sobolevn left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead we should do this?
» git patch diff --git Lib/rlcompleter.py Lib/rlcompleter.py index 206d6fb511c..62fd2c7fdec 100644 --- Lib/rlcompleter.py+++ Lib/rlcompleter.py@@ -176,8 +176,9 @@ def attr_matches(self, text): if (word[:n] == attr and not (noprefix and word[:n+1] == noprefix)): match = "%s.%s" % (expr, word) + import types if isinstance(getattr(type(thisobject), word, None), - property):+ (property, types.GetSetDescriptorType)): # bpo-44752: thisobject.word is a method decorated by # `@property`. What follows applies a postfix if # thisobject.word is callable, but know we know that WolframAlph commented Jan 12, 2024
Not really sure. My intention was to eliminate all possible warnings during completion (now and in future) no matter where they come from. Maybe it's the only possible path where it can happen but I am not sure since I never dealt with such things. Your solution looks cleaner to me and I believe you have broader context so I leave it up to you to decide. |
sobolevn commented Jan 12, 2024
My thoughs: properties should not evaluate when auto-complete works, so I think that adding an ignore just hides this problem. So, we should really address the root of this problem: do not execute |
WolframAlph commented Jan 12, 2024 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
I agree. But is this true only for built-in objects and their properties or user defined as well? classD: def__get__(self, _, __): print("evaluated") classC: prop=D()trying to get suggestions for |
sobolevn commented Jan 12, 2024
We can also try to replace |
WolframAlph commented Jan 14, 2024
Some things depend on being evaluated. Using cpython/Lib/test/test_rlcompleter.py Lines 51 to 85 in 77b45fa
Things like |
Thanks @WolframAlph for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…onGH-113979) (cherry picked from commit e03dde5) Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
GH-119429 is a backport of this pull request to the 3.13 branch. |

gh-113978