* imports are not handled well
Bug #1648647 reported by
Ethan Furman
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Currently, no effort is made to check names from a * import. Attached is a basic patch that does.
It works by exec'ing the "from ... import *" and using a locals dictionary to avoid polluting the module namespace, then adding all the names found as additional bindings. checkDeadScopes is modified to not report unused names from the * import as unused.
A better solution is probably to recursively run pyflakes on the * imported module to avoid possible side effects, but that is beyond my available time.
To post a comment you must log in.
Modified patch to fix the false positive of
... may be undefined, or defined from star imports: ...