tools to catch AttributeError and TypeError in python code?
jreiser at bitwagon.com
Mon Oct 22 15:25:31 UTC 2012
What is the state of software tools to help catch and prevent
AttributeError and TypeError in python code? These two classes
of errors occur often in the bugzilla reports for anaconda
(recently: https://bugzilla.redhat.com/show_bug.cgi?id=868707 ).
I'd like to see fewer AttributeError and TypeError.
Because new attributes and types may be created at run time, in general
errors may be even harder to find than in languages with static typing.
Yet for most python code the set of types and attributes is semi-fixed.
There are no changes at run time except due to importing modules
which were created long ago. During development, the set of types and
attributes changes only in bursts, and often the bursts are weeks apart.
The tools for python that I found by searching the web  seemed to be
oriented more towards syntax and style, and not including AttributeError
and TypeError. Nothing even came close to the depth and thoroughness
of BEAM  or Coverity  for C/C++. Help?
 google: python code checker
(IBM "BEAM" checker [Bugs, Errors, And Mistakes]; Guido Volleberg, 1999)
*very* good: finds and prints an execution path which leads to null-pointer
errors in C and C++; includes call+return, loop+exit, conditionals, etc.
Notably helpful in the development of valgrind itself.
More information about the devel