Skip to content
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

Fix hasattr(settings) AssertionError with mypy 0.990 #1239

Merged
merged 1 commit into from
Nov 8, 2022

Conversation

intgr
Copy link
Collaborator

@intgr intgr commented Nov 7, 2022

Fixes #1235. It seems this was caused by a new feature in mypy 0.990 involving hasattr(): python/mypy#13544

Fixes typeddjango#1235. It seems this was caused by a new feature in mypy 0.990 involving `hasattr()`.
from django.conf import settings
if hasattr(settings, 'AUTH_USER_MODEL') and settings.AUTH_USER_MODEL:
reveal_type(settings.AUTH_USER_MODEL)
if hasattr(settings, 'NON_EXISTANT_SETTING') and settings.NON_EXISTANT_SETTING:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test reproduces the issue #1235 and crashed without the fix.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the fix looks correct 👍

@sobolevn sobolevn merged commit 35847cc into typeddjango:master Nov 8, 2022
@sobolevn
Copy link
Member

sobolevn commented Nov 8, 2022

I propose to release new .1 release after merging #1238

@intgr intgr deleted the fix-hasattr-settings-mypy-0990 branch November 8, 2022 11:10
@intgr
Copy link
Collaborator Author

intgr commented Nov 8, 2022

@sobolevn Please walk me through the process of making a release.

@sobolevn
Copy link
Member

sobolevn commented Nov 8, 2022

Let's discuss it in #1095 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

mypy 0.990 breaks mypy_django_plugin
2 participants