* Tristan Seligmann <mithra...@mithrandi.net>, 2010-08-04, 04:50:
You might be easily mislead into thinking that this code...will catch both IOError and OSError exceptions. In fact, it will not, as it is more or less equivalent to:...There are about 50 packages in the archive whose developers make this kind of mistake. I have attached log file and dd-list. I'm not willing to do MBF, but if someone else is, please feel free to use my data.What about adding a lintian warning about this? Could file a bug about that?How would you implement the warning? There's no way to easily tell whether a given name is an existing class name or not.
I checked only for built-in exception names, which should cover most cases. A simple regex like:
^\s*except\s+[\w.]+\s*,\s*((?:Base)?Exception|(?:Arithmetic|Assertion|Attribute|Buffer|EOF|Environment|FloatingPoint|IO|Import|Indentation|Index|Key|Lookup|Memory|Name|NotImplemented|OS|Overflow|Reference|Runtime|Standard|Syntax|System|Tab|Type|UnboundLocal|UnicodeDecode|UnicodeEncode|Unicode|UnicodeTranslate|Value|ZeroDivision)Error|(?:Generator|System)Exit|(?:Bytes|Deprecation|Future|Import|Overflow|PendingDeprecation|Runtime|Syntax|Unicode|User)?Warning|StopIteration|KeyboardInterrupt)\s*: should do the trick. Also, feel free to file a bug against lintian. :) -- Jakub Wilk
signature.asc
Description: Digital signature