[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#592379: lintian: python packages with “except” overwriting builtins



Package: lintian
Severity: wishlist

Some python-based applications use incorrect constructs in their
exception handling, which was reported in the following thread and
results in some exceptions not being handled properly.

http://lists.debian.org/debian-python/2010/08/msg00001.html
http://lists.debian.org/debian-python/2010/08/threads.html#00001

According to Jakub Wilk, the following regex can be used to find python
files which use the built-in exception types incorrectly:

^\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*:

If the lintian package shouldn't contain individual language-specific
tests like this, then this test should be implemented in pychecker,
pylint or pyflakes and a lintian extras test implemented to use these
tools to check python stuff.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: