-
For a variable defined in a module scope, and stack frame object's locals and globals scope dictionaries each contain that variables name mapped to None.
This confuses python code which inspects the bindings, such as pdb. Such code incorrectly reports the value as None.
It may be that the binding values are correct at the time of exception generation, but altered by the time the exception...
2007-07-04 19:53:11 UTC in Python
-
nejucomo registered the Python binding annotations. project.
2007-03-26 11:05:11 UTC in Python binding annotations.
-
This feature has already been present in the stdlib for awhile, hidden in the cgitb module. Enable it like this:
import cgitb
cgitb.enable(format="text")
I was not aware of this, assuming cgitb just formatted typical tracebacks into html. Perhaps a better design of traceback reporting in general is called for?.
2007-02-21 21:26:27 UTC in Python
-
I've simplified and modularized the design of this tool. Included is a patch against the 2.6 svn head which adds a module to the stdlib called bindann (for "binding annotation"), and then modifies the traceback module to use it. It also includes a demo script which compares classic and annotated exception tracebacks.
The interface to traceback is backwards compatible (it introduces optional.
2007-02-12 19:00:00 UTC in Python
-
BTW, I only tested this on python 2.4.
Because it examines the parse tree (very simply), it may not work if the AST format changes. The only parsing it does is search for all NAME tokens which are not keywords, so I assumed this was stable across releases.
2007-02-08 09:50:36 UTC in Python
-
The attached module provides a suitable replacement for sys.excepthook to handle uncaught exceptions.
The output is the same, except after each source line shown, a list of relevant bindings is shown.
Here's a quick example from the tail end of a test:
File "./test-exprann.py", line 16, in f
assert c == 12
# With bindings:
# c = 42
AssertionError
The bindings...
2007-02-08 09:46:01 UTC in Python
-
nejucomo committed revision 29 to the LARAN SVN repository, changing 2 files.
2006-11-29 08:19:09 UTC in LARAN
-
nejucomo committed revision 28 to the LARAN SVN repository, changing 3 files.
2006-11-29 08:17:26 UTC in LARAN
-
nejucomo committed revision 27 to the LARAN SVN repository, changing 1 files.
2006-11-29 07:38:53 UTC in LARAN
-
nejucomo committed revision 26 to the LARAN SVN repository, changing 1 files.
2006-11-29 07:28:59 UTC in LARAN