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

Reported by Tom Berger on 2008-07-04
6
Affects Status Importance Assigned to Milestone
Launchpad itself
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.

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
Tom 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) on 2010-07-05
visibility: private → public
Curtis Hovey (sinzui) on 2010-07-06
Changed in launchpad-foundations:
assignee: nobody → Curtis Hovey (sinzui)
milestone: none → 10.08
status: Triaged → In Progress
importance: Medium → High
Curtis Hovey (sinzui) on 2010-07-08
Changed in launchpad-foundations:
status: In Progress → Fix Released
Curtis Hovey (sinzui) on 2010-07-11
tags: added: qa-ok
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers