Fix python 3.11 regression with Python console autocomplete#15885
Merged
Conversation
Member
|
@LeonarddeR - is it worth raising an issue with python as well? |
seanbudd
approved these changes
Dec 6, 2023
|
|
||
| class Completer(rlcompleter.Completer): | ||
|
|
||
| def attr_matches(self, text): |
Collaborator
Author
I'm not sure what the solution should be, adding try/except around getattr again or something else. What I'd propose is creating an abstract class for Non-Data descriptors and check for that instead of for |
Collaborator
Author
|
I filed python/cpython#112821 |
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.
Link to issue number:
Fixes #15872
Summary of the issue:
Since python 3.10, auto completion in the Python Console would fail when trying to complete a string that matches an AutoPropertyObject getter raising NotImplementedError. This is because starting from 3.10, the code responsible for matching no longer catches exceptions for getattr. Instead, it ensures that
propertydescriptors are filtered out. In my opinion, solution from Python is far from ideal, since it doesn't deal with other descriptors, like ourbaseObject.Getter.Description of user facing changes
Fixes auto completion
Description of development approach
Copied and adapted code from Python 3.9.
Testing strategy:
Tested str from #15872
Known issues with pull request:
We could also consider keeping the Python 3.11 code, but instead expanding it to baseObject.Getter. This would imply a change in behavior, as properties that raise exceptions would be included in the auto complete list.
Code Review Checklist: