Python Code Auditing Tool

Robey Holderith robey at flaminglunchbox.net
Wed Feb 2 00:47:53 EST 2005


Does anybody know of a tool that can tell me all possible exceptions that
might occur in each line of code?  What I'm hoping to find is something
like the following:

given all necessary python source and a given line ( my.py:40 ) it would
generate a list of possible exception classes sorted by function
(preferably in a tree).

Example:
------------------

my.py:40 |    parsestring(genstring())

Possible Exceptions:

-def parsestring():
  InvalidCharacterException
  EmptyStringException
  -class string, def split():
    (All Exceptions that might occur directly in string.split() that are
    not caught by parsestring())
    (All functions called by string.split() and their exceptions and sub-
    functions)
-def genstring():
  SomeException
  ...

--------------------

This would be extremely useful for deciding how to write try: except
blocks and in figuring out what all possible errors that might occur would
be.

-Robey Holderith




More information about the Python-list mailing list