You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Regression: 0.470->0.501] Lots of new errors relating to "uninhabited" in Django-based app code #2978
git clone https://github.com/inducer/relate
cd relate
./run-mypy.sh
used to work with no warnings in 0.470. Now, it spews this:
course/content.py:877: error: <uninhabited> has no attribute "id"
course/content.py:1445: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/content.py:1446: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:179: error: <uninhabited> has no attribute "exam"
course/utils.py:533: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:534: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:583: error: <uninhabited> has no attribute "permissions"
course/enrollment.py:129: error: <uninhabited> has no attribute "roles"
course/enrollment.py:143: error: <uninhabited> has no attribute "permissions"
course/views.py:156: error: <uninhabited> has no attribute "has_permission"
course/flow.py:416: error: <uninhabited> has no attribute "user"
course/flow.py:633: error: <uninhabited> has no attribute "answer"
course/flow.py:830: error: <uninhabited> has no attribute "get_most_recent_grade"
course/flow.py:848: error: Unsupported left operand type for + (some union)
course/flow.py:855: error: Unsupported left operand type for + (some union)
course/flow.py:862: error: Unsupported left operand type for + (some union)
course/flow.py:923: error: <uninhabited> has no attribute "is_submitted_answer"
course/flow.py:924: error: <uninhabited> has no attribute "save"
course/flow.py:1264: error: <uninhabited> has no attribute "get_most_recent_grade"
course/flow.py:1884: error: Call to untyped function "make_form" in typed context
course/flow.py:1943: error: Call to untyped function "form_to_html" in typed context
course/grading.py:189: error: Call to untyped function "make_form" in typed context
course/grading.py:206: error: Call to untyped function "form_to_html" in typed context
course/grading.py:229: error: Call to untyped function "update_grade_data_from_grading_form_v2" in typed context
course/content.py:1445: error: object has no attribute "preview_git_commit_sha"
course/content.py:1446: error: object has no attribute "preview_git_commit_sha"
course/utils.py:533: error: object has no attribute "preview_git_commit_sha"
course/utils.py:534: error: object has no attribute "preview_git_commit_sha"
course/utils.py:583: error: object has no attribute "permissions"
course/enrollment.py:129: error: object has no attribute "roles"
course/views.py:156: error: object has no attribute "has_permission"
course/flow.py:1264: error: object has no attribute "get_most_recent_grade"
course/content.py:1445: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/content.py:1446: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:533: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:534: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:583: error: <uninhabited> has no attribute "permissions"
course/enrollment.py:129: error: <uninhabited> has no attribute "roles"
course/views.py:156: error: <uninhabited> has no attribute "has_permission"
course/flow.py:1264: error: <uninhabited> has no attribute "get_most_recent_grade"
course/content.py:877: error: <uninhabited> has no attribute "id"
course/content.py:1445: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/content.py:1446: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:179: error: <uninhabited> has no attribute "exam"
course/utils.py:533: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:534: error: <uninhabited> has no attribute "preview_git_commit_sha"
course/utils.py:583: error: <uninhabited> has no attribute "permissions"
course/enrollment.py:129: error: <uninhabited> has no attribute "roles"
course/enrollment.py:143: error: <uninhabited> has no attribute "permissions"
course/views.py:156: error: <uninhabited> has no attribute "has_permission"
course/flow.py:416: error: <uninhabited> has no attribute "user"
course/flow.py:633: error: <uninhabited> has no attribute "answer"
course/flow.py:830: error: <uninhabited> has no attribute "get_most_recent_grade"
course/flow.py:848: error: Unsupported left operand type for + (some union)
course/flow.py:855: error: Unsupported left operand type for + (some union)
course/flow.py:862: error: Unsupported left operand type for + (some union)
course/flow.py:923: error: <uninhabited> has no attribute "is_submitted_answer"
course/flow.py:924: error: <uninhabited> has no attribute "save"
course/flow.py:1264: error: <uninhabited> has no attribute "get_most_recent_grade"
Oh well, I knew that the bad commit was only a partial fix, but I didn't foresee these problems. A more complete fix that I was working on caused many problems with internal Dropbox code. The bad commit fixed other urgent issues so just reverting it is not a good option. I'll look at finishing up the more complete fix.
Activity
gvanrossum commentedon Mar 8, 2017
Yeah, I can repro this. @ddfisher The script uses
--strict-optional.I experimented with that one location a bit, and found:
if course is not None ...withif course ...the error goes away.reveal_type(course)inside theifshows<uninhabited>; with that change it showsCourse.if,reveal_type(course)showsOptional[Course].Definitely sounds like a binder issue...
gvanrossum commentedon Mar 8, 2017
@inducer If you want to help, maybe you can use
git bisectto track down the exact mypy commit that caused this?inducer commentedon Mar 8, 2017
Would love to, but paper deadline and 12 proposals to review over the next 7 days... Sorry!
refi64 commentedon Mar 9, 2017
Under mypy 0.47, I still get:
refi64 commentedon Mar 9, 2017
Looks like some of the errors were caused by 9496d6f; I'm still trying to locate the others.
refi64 commentedon Mar 9, 2017
Oof, this one's a mess...more of the errors were from 9406886, but there are still some that haven't come up yet...
refi64 commentedon Mar 9, 2017
Around half of the errors were from, bizarrely enough, 3cc5201.
So, to sum it up:
9496d6f started the trouble:
9406886 changed the
objects to<uninhabited>:3cc5201 somehow just made it all worse:
refi64 commentedon Mar 9, 2017
Also, I can confirm that 9496d6f was the root cause; temporarily reverting it made the errors go away.
gvanrossum commentedon Mar 9, 2017
Thanks for the great investigation! Hopefully Jukka knows how to fix it.
refi64 commentedon Mar 9, 2017
Reduced test case:
(The
Anystemmed from a class inside of a non-existent import, since--ignore-missing-importswas passed).Ironically enough, the bad commit's message says:
:/
refi64 commentedon Mar 9, 2017
Also, this was caused by the same commit:
JukkaL commentedon Mar 10, 2017
Oh well, I knew that the bad commit was only a partial fix, but I didn't foresee these problems. A more complete fix that I was working on caused many problems with internal Dropbox code. The bad commit fixed other urgent issues so just reverting it is not a good option. I'll look at finishing up the more complete fix.
ddfisher commentedon Mar 14, 2017
Well, one problem is we need to kill this:
JukkaL commentedon Mar 14, 2017
@ddfisher Yup, that's gone in my private branch.
Fix #2978.
Fix #2978.
Fixes to union simplification, isinstance and more (#3025)
Fixes to union simplification, isinstance and more (#3025)
JukkaL commentedon Apr 4, 2017
I think that this is still open because the fix was reverted.