make lint should recognize (and not warn about) try...except imports of modules

Bug #245514 reported by Eleanor Berger
6
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Curtis Hovey

Bug Description

Occasionally we want to import a module, but only if the import of another module fails, using the same name. For example, this is a popular idiom when importing a module which has a native code version which is only available on some tergets:

try:
  from themodule import TheClass
except:
  from cThemodule import cTheClass as TheClass

Currently, PyFlakes warns about such cases, but it should be possible to recognize that this is valid, and not warn.

We could either try to fix PyFlakes, or figure out in what cases it's safe to ignore the warning.

Revision history for this message
Francis J. Lacoste (flacoste) wrote :

Is this a problem in our use of lint, or a limitations of lint itself?

Changed in launchpad:
status: New → Incomplete
Revision history for this message
Eleanor Berger (intellectronica) wrote :

Actually, the problem is coming from PyFlakes (and it's in the program, not in how we use it).

description: updated
Changed in launchpad:
status: Incomplete → New
Changed in launchpad:
importance: Undecided → Medium
status: New → Confirmed
Curtis Hovey (sinzui)
visibility: private → public
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
assignee: nobody → Curtis Hovey (sinzui)
milestone: none → 10.08
status: Triaged → In Progress
importance: Medium → High
Curtis Hovey (sinzui)
Changed in launchpad-foundations:
status: In Progress → Fix Released
Curtis Hovey (sinzui)
tags: added: qa-ok
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.