-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-131936: Relax assertion in _Py_CalculateSuggestions
#131943
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
gh-131936: Relax assertion in _Py_CalculateSuggestions
#131943
Conversation
|
||
# gh-131936: _Py_CalculateSuggestions wanted exactly a list | ||
class MyList(list): | ||
def __getitem__(self, *_): |
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.
Why not just:
def __getitem__(self, *_): | |
def __getitem__(self, item): |
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.
This change looks wrong. MyList.__getitem__()
should be called, but it's not.
Either require the exact list type, or modify the code to use PySequence_GetItem()
. I prefer to keep the exact list type. It's an internal module, it doesn't have to support list subclasses.
I put up #131945 as an alternative. I'm not sure what the rule/expected behavior is for |
I merged #131945 instead. |
Another option is to validate that
_generate_suggestions
is given exactly a list, but I don't see why we should require that. I'm not adding a blurb entry because_generate_suggestions
is solely internal._suggestions__generate_suggestions_impl
and_Py_CalculateSuggestions
#131936