1.1 --- a/annotate.py Mon Dec 11 23:49:25 2006 +0100
1.2 +++ b/annotate.py Mon Dec 11 23:51:42 2006 +0100
1.3 @@ -531,7 +531,7 @@
1.4 for attr in self.namespace.types:
1.5 attributes = get_attributes(attr.type, loadattr.name)
1.6 if not attributes:
1.7 - if not attr.type in non_accesses:
1.8 + if not attr in non_accesses:
1.9 non_accesses.append(attr)
1.10
1.11 # Revoke this type from any name involved.
1.12 @@ -570,15 +570,24 @@
1.13
1.14 if isinstance(expr, LoadName):
1.15 self.namespace.revoke(expr.name, attr)
1.16 - elif isinstance(expr, LoadAttr):
1.17 - for expr_attr in expr.expr.types:
1.18 - if hasattr(expr_attr.type, "namespace"):
1.19 - expr_attr.type.namespace.revoke(expr.name, attr)
1.20 elif isinstance(expr, LoadExc):
1.21 self.namespace.revoke_exception_type(attr)
1.22 elif isinstance(expr, LoadTemp):
1.23 self.namespace.revoke_temp_type(expr.index, attr)
1.24
1.25 + # LoadAttr cannot be pruned since this might unintentionally prune
1.26 + # legitimate types from other applications of the referenced type, it
1.27 + # almost certainly doesn't take "concurrent" mutation into
1.28 + # consideration (where in a running program, the pruned type is actually
1.29 + # reintroduced, making the pruning invalid), and there is no easy way of
1.30 + # preserving the meaning of a namespace without either creating lots of
1.31 + # specialised instances, and even then...
1.32 +
1.33 + #elif isinstance(expr, LoadAttr):
1.34 + # for expr_attr in expr.expr.types:
1.35 + # if hasattr(expr_attr.type, "namespace"):
1.36 + # expr_attr.type.namespace.revoke(expr.name, attr)
1.37 +
1.38 def visitLoadExc(self, loadexc):
1.39
1.40 """
1.41 @@ -1229,7 +1238,9 @@
1.42
1.43 "Revoke from the entry for the given 'name' the specified 'type'."
1.44
1.45 - self.names[name].remove(type)
1.46 + new_types = self.names[name][:]
1.47 + new_types.remove(type)
1.48 + self.names[name] = new_types
1.49
1.50 def revoke_exception_type(self, type):
1.51