1.1 --- a/micropython/data.py Mon Oct 26 00:26:07 2009 +0100
1.2 +++ b/micropython/data.py Mon Oct 26 01:03:38 2009 +0100
1.3 @@ -304,6 +304,9 @@
1.4 self.attributes_used.add(attrname)
1.5 return self.attributes_used
1.6
1.7 + def exposes_name(self, attrname):
1.8 + return attrname in self.attributes_used
1.9 +
1.10 # Value-related methods.
1.11
1.12 def get_contexts(self):
2.1 --- a/micropython/inspect.py Mon Oct 26 00:26:07 2009 +0100
2.2 +++ b/micropython/inspect.py Mon Oct 26 01:03:38 2009 +0100
2.3 @@ -198,13 +198,20 @@
2.4 "Vacuum the given object 'obj'."
2.5
2.6 for name, attr in obj.items():
2.7 +
2.8 + # Only consider deleting entire unused objects or things accessible
2.9 + # via names which are never used.
2.10 +
2.11 if delete_all or not self.importer.uses_name(name):
2.12 del obj[name]
2.13 +
2.14 + # Delete any unambiguous attribute value. Such values can only
2.15 + # have been defined within the object and therefore are not
2.16 + # redefined by other code regions.
2.17 +
2.18 if attr.assignments == 1:
2.19 value = attr.get_value()
2.20
2.21 - # Delete any unambiguous attribute value.
2.22 -
2.23 if value is not obj and value in self.all_objects:
2.24 self.all_objects.remove(value)
2.25