-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Python: Modernize iter not returning self query #19554
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
base: main
Are you sure you want to change the base?
Python: Modernize iter not returning self query #19554
Conversation
QHelp previews: python/ql/src/Functions/IterReturnsNonSelf.qhelpIterator does not return self from
|
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.
A few minor comments, but otherwise this looks good to me. 👍
next = nextMethod(c) and | ||
iter = iterMethod(c) and | ||
returnsNonSelf(iter) and | ||
not iterWrapperMethods(iter, next) |
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 where
clause requires that there be both an __iter__
and a __next__
method present. What if only the __next__
method is present? It might make sense to also flag this case.
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.
Potentially useful. The alert for that case would have to be different (doesn't link to the __iter__
method) which is a little trickier to handle.
…tionally add some more doc comments
Removes dependence on pointsto and adresses a couple common FP cases.