-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
[5.0.3 regression] error: "type[RealmFilter]" has no attribute "objects" [attr-defined] #2304
[5.0.3 regression] error: "type[RealmFilter]" has no attribute "objects" [attr-defined] #2304
Comments
appears to be a weird ordering thing -- #2280 will fix this probably (that or the what's happening is the plugin does a pass over your class -- notices the correct type exists ( I'm surprised none of the tests hits this -- and we don't hit this at sentry because we turn off deletion of |
I couldn't get the case above to reproduce in |
I just want to reference that |
This is until upstream fixes typeddjango/django-stubs#2304
### Description This is until upstream fixes typeddjango/django-stubs#2304
I realised that our plugin tries to adjust the model class from the
Ref: https://mypy.readthedocs.io/en/stable/extending_mypy.html#current-list-of-plugin-hooks But the code tries to expect and look through the class body... A fix for this is instead to move to adjust the model class via the Anyways, above is some quite specific details, in the end it's just to change the plugin to use another hook. I'll add a fix for this. |
When trying to upgrade to django-stubs 5.0.3 or 5.0.4 in Zulip, I get 25 unexpected errors like
error: "type[RealmFilter]" has no attribute "objects" [attr-defined]
. This is not #1684;RealmFilter
is a normal concrete model class. The issue seems to depend on the structure of the project’s import graph.Based on
git bisect
, it first occurs atI’ve reduced the issue to this minimized test case: https://github.com/andersk/no-attribute-objects
pyproject.toml
confirmation/__init__.py
(empty)confirmation/models.py
zerver/__init__.py
(empty)zerver/models/__init__.py
zerver/models/linkifiers.py
zerver/models/realms.py
zerver/models/streams.py
zerver/models/users.py
zproject/__init__.py
(empty)zproject/settings.py
The text was updated successfully, but these errors were encountered: