gh-131936: Relax assertion in _Py_CalculateSuggestions #131943
Closed
ZeroIntensity wants to merge 4 commits intopython:mainfrom
Closed
gh-131936: Relax assertion in _Py_CalculateSuggestions #131943ZeroIntensity wants to merge 4 commits intopython:mainfrom
_Py_CalculateSuggestions #131943ZeroIntensity wants to merge 4 commits intopython:mainfrom
Conversation
vstinner
reviewed
Mar 31, 2025
|
|
||
| # gh-131936: _Py_CalculateSuggestions wanted exactly a list | ||
| class MyList(list): | ||
| def __getitem__(self, *_): |
Member
There was a problem hiding this comment.
Why not just:
Suggested change
| def __getitem__(self, *_): | |
| def __getitem__(self, item): |
vstinner
reviewed
Mar 31, 2025
Member
vstinner
left a comment
There was a problem hiding this comment.
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.
Member
Author
|
I put up #131945 as an alternative. I'm not sure what the rule/expected behavior is for |
Member
|
I merged #131945 instead. |
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.
Another option is to validate that
_generate_suggestionsis given exactly a list, but I don't see why we should require that. I'm not adding a blurb entry because_generate_suggestionsis solely internal._suggestions__generate_suggestions_impland_Py_CalculateSuggestions#131936