1.1 --- a/micropython/inspect.py Mon Oct 26 00:26:07 2009 +0100
1.2 +++ b/micropython/inspect.py Mon Oct 26 01:03:38 2009 +0100
1.3 @@ -198,13 +198,20 @@
1.4 "Vacuum the given object 'obj'."
1.5
1.6 for name, attr in obj.items():
1.7 +
1.8 + # Only consider deleting entire unused objects or things accessible
1.9 + # via names which are never used.
1.10 +
1.11 if delete_all or not self.importer.uses_name(name):
1.12 del obj[name]
1.13 +
1.14 + # Delete any unambiguous attribute value. Such values can only
1.15 + # have been defined within the object and therefore are not
1.16 + # redefined by other code regions.
1.17 +
1.18 if attr.assignments == 1:
1.19 value = attr.get_value()
1.20
1.21 - # Delete any unambiguous attribute value.
1.22 -
1.23 if value is not obj and value in self.all_objects:
1.24 self.all_objects.remove(value)
1.25