# HG changeset patch # User paulb@localhost.localdomain # Date 1165877502 -3600 # Node ID c1f7c777c71471ce7e093a4b4b72ef8d16e84392 # Parent 3f4660d4f62f6ee065023fc2a9b0aa243f9e3b6a Removed attribute type pruning. Fixed name type revocation so that it does not affect any current iteration over the list of types for a name. Fixed the test for an attribute in the non_accesses list. diff -r 3f4660d4f62f -r c1f7c777c714 annotate.py --- a/annotate.py Mon Dec 11 23:49:25 2006 +0100 +++ b/annotate.py Mon Dec 11 23:51:42 2006 +0100 @@ -531,7 +531,7 @@ for attr in self.namespace.types: attributes = get_attributes(attr.type, loadattr.name) if not attributes: - if not attr.type in non_accesses: + if not attr in non_accesses: non_accesses.append(attr) # Revoke this type from any name involved. @@ -570,15 +570,24 @@ if isinstance(expr, LoadName): self.namespace.revoke(expr.name, attr) - elif isinstance(expr, LoadAttr): - for expr_attr in expr.expr.types: - if hasattr(expr_attr.type, "namespace"): - expr_attr.type.namespace.revoke(expr.name, attr) elif isinstance(expr, LoadExc): self.namespace.revoke_exception_type(attr) elif isinstance(expr, LoadTemp): self.namespace.revoke_temp_type(expr.index, attr) + # LoadAttr cannot be pruned since this might unintentionally prune + # legitimate types from other applications of the referenced type, it + # almost certainly doesn't take "concurrent" mutation into + # consideration (where in a running program, the pruned type is actually + # reintroduced, making the pruning invalid), and there is no easy way of + # preserving the meaning of a namespace without either creating lots of + # specialised instances, and even then... + + #elif isinstance(expr, LoadAttr): + # for expr_attr in expr.expr.types: + # if hasattr(expr_attr.type, "namespace"): + # expr_attr.type.namespace.revoke(expr.name, attr) + def visitLoadExc(self, loadexc): """ @@ -1229,7 +1238,9 @@ "Revoke from the entry for the given 'name' the specified 'type'." - self.names[name].remove(type) + new_types = self.names[name][:] + new_types.remove(type) + self.names[name] = new_types def revoke_exception_type(self, type):