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
Commit 7b7c7ad
Browse filesBrowse the repository at this point in the historyBrowse files
Detect and support module aliasing via assignment. (#3435)
* Detect and support module aliasing via assignment.
In semantic analysis, if we find a simple assignment statement where the rvalue
is a module, make the lvalue a direct alias to that same module.
Fixes#1778.
* Handle chained assignment and iterable unpacking assignment.
* Remove test case that was only for exploration, not intended for inclusion.
* Add some more tests for module assignment.
* Also add tests for access/assignment of nonexistent module attribute.
* Break down code and add comments for clarity; add test for mismatch lengths.
* Naming improvements.
* Support tracking module assignment in non-global scope.
* Add more tests for unpacking mismatch cases.
* Keep rvals always on the right.
* Don't use a form of unpacking that is Py35+ only.
* It's the zip that is problematic, not just the unpacking.
* Add tests for module assignment in class and local scopes.
* Simplify to single method.
* Go back to annotating genericpath as Any in stdlib-sample.
* Respect explicit type annotation and don't propagate module reference.
* Backtrack to simple ModuleType var in case of incompatible module aliasing.
* Remove stray pdb comment.
* Also handle reassignment of an original (non-alias) module reference.
* Simplify: fail on assignment of different modules to same variable without explicit annotation.
* Style and working tweaks.
0 commit comments