1.1 --- a/micropython/inspect.py Fri Jun 29 01:44:08 2012 +0200
1.2 +++ b/micropython/inspect.py Sat Jun 30 00:02:31 2012 +0200
1.3 @@ -598,11 +598,14 @@
1.4 where such attributes are inferred from the usage.
1.5 """
1.6
1.7 - # Access to attribute via a local in functions or classes but not
1.8 + # Access to attributes via a local in functions or classes but not
1.9 # modules (since module-level locals are globals that can be modified
1.10 - # independently of the namespace).
1.11 + # independently of the namespace), or access via a module global within
1.12 + # a function.
1.13
1.14 - if expr.parent is self.get_namespace() and not self.get_namespace() is self:
1.15 + if expr.parent is self.get_namespace() and not self.get_namespace() is self or \
1.16 + expr.parent is self and self.in_function:
1.17 +
1.18 self.define_attribute_accessor(expr.name, attrname, node, value)
1.19 else:
1.20 self.use_name(attrname, node.expr, value, ns=expr.parent)