# HG changeset patch # User Paul Boddie # Date 1216142956 -7200 # Node ID 721d44d4eaf857abd29341eaeda62997b6c7dcad # Parent 3b25077049575b86833a500e23202638af031b38 Fix exception handler inspection. Added traceback switch on the test program. Added docstring. diff -r 3b2507704957 -r 721d44d4eaf8 micropython/ast.py --- a/micropython/ast.py Mon Jun 30 00:32:54 2008 +0200 +++ b/micropython/ast.py Tue Jul 15 19:29:16 2008 +0200 @@ -115,6 +115,9 @@ return self.code def get_scope(self, name): + + "Return the scope for the given 'name'." + if self.unit.has_key(name): return "local" elif self.module.has_key(name): diff -r 3b2507704957 -r 721d44d4eaf8 micropython/inspect.py --- a/micropython/inspect.py Mon Jun 30 00:32:54 2008 +0200 +++ b/micropython/inspect.py Tue Jul 15 19:29:16 2008 +0200 @@ -594,8 +594,10 @@ # Establish the local for the handler. - self.dispatch(var) - self.dispatch(n) + if var is not None: + self.dispatch(var) + if n is not None: + self.dispatch(n) if node.else_ is not None: self.dispatch(node.else_) return None diff -r 3b2507704957 -r 721d44d4eaf8 test.py --- a/test.py Mon Jun 30 00:32:54 2008 +0200 +++ b/test.py Tue Jul 15 19:29:16 2008 +0200 @@ -62,6 +62,8 @@ m = i.load_from_file(program) except micropython.ProcessingError, exc: print repr(exc) + if "-tb" in args: + raise else: i.vacuum() ot = i.get_object_table()