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

Always set correct kind for module __getattr__ #5893

Merged
merged 4 commits into from Nov 15, 2018

Conversation

Projects
None yet
2 participants
@ilevkivskyi
Copy link
Collaborator

ilevkivskyi commented Nov 14, 2018

Fixes #5866

There are two places where __getattr__ generated Vars are created, and somehow in one of them it was given a MDEF kind (which caused a crash), although it is a module attribute.

@JukkaL
Copy link
Collaborator

JukkaL left a comment

Looks good, just one question about possible additional test case.

@@ -2627,3 +2627,35 @@ import foo.bar.baz
reveal_type(foo.bar.baz.x) # E: Revealed type is 'builtins.int'
[file foo/bar/baz.py]
x = 0

[case testModuleGetAttrAssignUnannotated]

This comment has been minimized.

@JukkaL

JukkaL Nov 14, 2018

Collaborator

What about testing a package with a missing explicit submodule (__getattr__ in __init__) and then assigning something to a submodule attribute? Or is this still unsupported?

This comment has been minimized.

@ilevkivskyi

ilevkivskyi Nov 14, 2018

Collaborator

OK, I added two tests for this.

Ivan Levkivskyi

@ilevkivskyi ilevkivskyi merged commit af5df38 into python:master Nov 15, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ilevkivskyi ilevkivskyi deleted the ilevkivskyi:module-getattr-set-crash branch Nov 15, 2018

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