← Back to team overview

divmod-dev team mailing list archive

[Bug 848455] [NEW] Detect misuse of except

 

Public bug reported:

It would be nice if pyflakes could detect mistakes like this:

       try:
           oldtime = os.path.getmtime(fname)
       except OSError, IOError:
           oldtime = 0

In the general case, it's obviously difficult to tell whether this is an
error or not; but I suspect that handling the exception variable name as
a binding would give you a "redefinition of Foo" warning in most of the
cases where a mistake has been made.

** Affects: pyflakes
     Importance: Wishlist
         Status: New

-- 
You received this bug notification because you are a member of Divmod-
dev, which is the registrant for Pyflakes.
https://bugs.launchpad.net/bugs/848455

Title:
  Detect misuse of except

Status in Pyflakes:
  New

Bug description:
  It would be nice if pyflakes could detect mistakes like this:

         try:
             oldtime = os.path.getmtime(fname)
         except OSError, IOError:
             oldtime = 0

  In the general case, it's obviously difficult to tell whether this is
  an error or not; but I suspect that handling the exception variable
  name as a binding would give you a "redefinition of Foo" warning in
  most of the cases where a mistake has been made.

To manage notifications about this bug go to:
https://bugs.launchpad.net/pyflakes/+bug/848455/+subscriptions


Follow ups

References