# HG changeset patch # User Paul Boddie # Date 1232761319 -3600 # Node ID 09d961170f35a4f1b2adc05c08b6a5daeef6ade6 # Parent ac2d54b745165a3e84fae07784e0145472b399f3 Fix unused objects optimisation for Attr instances with no predictable assignment values. diff -r ac2d54b74516 -r 09d961170f35 micropython/inspect.py --- a/micropython/inspect.py Sun Jan 18 02:09:41 2009 +0100 +++ b/micropython/inspect.py Sat Jan 24 02:41:59 2009 +0100 @@ -156,14 +156,15 @@ # Only remove entries for classes and functions, not methods. - for attr_value in value.assignment_values: - if (isinstance(attr_value, Function) and not attr_value.is_method() or - isinstance(attr_value, Class)) and not attr_value.referenced: - pass + if attr_value is not None: + for attr_value in value.assignment_values: + if (isinstance(attr_value, Function) and not attr_value.is_method() or + isinstance(attr_value, Class)) and not attr_value.referenced: + pass + else: + break else: - break - else: - del self[name] + del self[name] # Complain about globals not initialised at the module level.