1.1 --- a/micropython/deduce.py Sun Oct 13 21:39:21 2013 +0200
1.2 +++ b/micropython/deduce.py Mon Oct 14 00:07:56 2013 +0200
1.3 @@ -126,6 +126,20 @@
1.4 node._set_context = instance_target and "set" or None
1.5 return
1.6
1.7 + # If a reliable target was originally specified, any usable attributes
1.8 + # should have been detected above, and any attributes deduced by other
1.9 + # means will not be compatible with the target. Thus, the nature of the
1.10 + # target is investigated: it must be an inspectable namespace or be an
1.11 + # attribute only providing such namespaces; otherwise, it is possible
1.12 + # that deduced attributes might be appropriate.
1.13 +
1.14 + if target and (
1.15 + isinstance(target, (Class, Module)) or
1.16 + isinstance(target, Attr) and not [v for v in target.get_values() if not isinstance(v, (Class, Module))]
1.17 + ):
1.18 + node._access_type = "impossible"
1.19 + return
1.20 +
1.21 # Attributes of self, which is by definition an instance.
1.22
1.23 if self.provides_self_access(node, unit):
1.24 @@ -218,6 +232,8 @@
1.25 if not targets:
1.26 targets = attribute_targets
1.27
1.28 + # Get the attributes from the deduced targets.
1.29 +
1.30 node._attrs_deduced_from_specific_usage = self.get_attributes(specific_targets, node.attrname)
1.31 node._attrs_deduced_from_usage = attrs = self.get_attributes(targets, node.attrname)
1.32