-
Notifications
You must be signed in to change notification settings - Fork 116
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
Infinite loop calculating mro in astroid>=1.3.3 #37
Comments
…n into consideration: https://bitbucket.org/logilab/astroid/commits/b1d8107715a4ceeeeb3f4a9065b67817e8cdc643 This caused an infinite loop when using pylint-django, as the model and form field transforms extended the base Django object then replaced it. This caused the MRO lookup to find a class as its own ancestor. The model and form field transforms have been simplified, so that instead of building a module and replacing each class individually, instead, the correct "dummy" parent class is simply appended. This means that the original parent node (eg, CharField) is not replaced by itself. This also has the side effect of no longer confusing pylint when it comes to __init__/__new__ differences for field classes which extend "immutable" base classes as a result of this transform.
…o infer that fields are both their original subclass and also a type shim representing them at runtime. Also, supresses R0903 (too few methods) from models and views, which started happening recently
Any chance of cutting a new release with this fix? |
@akshayjshah I've been working on it but so far all my solutions have had the same problem. Getting closer though! |
Gotcha - thanks! |
In the end I submitted a PR to astroid itself too: https://bitbucket.org/logilab/astroid/pull-request/67/mro-lookups-can-get-into-an-infinite-loop However I don't know when that will be released so I've also patched pylint-django. Once I've verified it builds and the tests pass, and fixed a couple of small remaining bugs, I'll create a new PyPI release. |
As of astroid 1.3.3, class method resolution order is taken into consideration: https://bitbucket.org/logilab/astroid/commits/b1d8107715a4ceeeeb3f4a9065b67817e8cdc643
This caused an infinite loop when using pylint-django, as the model and form field transforms extended the base Django object then replaced it. This caused the MRO lookup to find a class as its own ancestor.
The text was updated successfully, but these errors were encountered: