# HG changeset patch # User Paul Boddie # Date 1394489414 -3600 # Node ID 799f9a912fe6901411ad6c0fe4dc9db0b616b088 # Parent 212f9749130e32e35924d8f3c4316a8bfeceaa1c Reinstated proper testing for real AttributeError occurrences. diff -r 212f9749130e -r 799f9a912fe6 micropython/deduce.py --- a/micropython/deduce.py Sun Mar 09 18:51:11 2014 +0100 +++ b/micropython/deduce.py Mon Mar 10 23:10:14 2014 +0100 @@ -3,7 +3,7 @@ """ Perform deductions on an inspected program. -Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 Paul Boddie +Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013, 2014 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -20,7 +20,7 @@ """ from micropython.stdcompiler import compiler -from compiler.ast import AssAttr, Getattr, Name +from compiler.ast import * from micropython.basicdata import Const, Constant, TypedInstance from micropython.common import ASTVisitor, used_by_unit @@ -66,15 +66,15 @@ return node.visit(self.visitor, *args) except AttributeError: # NOTE: Obligatory hack to find real attribute errors. - #if isinstance(node, self.implemented_nodes): - # raise + if isinstance(node, self.implemented_nodes): + raise return self.visitor.default(node, *args) - #implemented_nodes = ( - # AssAttr, Assign, AssName, AssList, AssTuple, CallFunc, Getattr, - # Add, Bitand, Bitor, Bitxor, Div, FloorDiv, Invert, LeftShift, Mod, Mul, - # Power, RightShift, Sub, UnaryAdd, UnarySub - # ) + implemented_nodes = ( + AssAttr, Assign, AssName, AssList, AssTuple, CallFunc, Function, Getattr, + Add, Bitand, Bitor, Bitxor, Div, FloorDiv, Invert, LeftShift, Mod, Mul, + Power, RightShift, Sub, UnaryAdd, UnarySub + ) # Deduction-related methods.