# HG changeset patch # User Paul Boddie # Date 1258930410 -3600 # Node ID 4435e910a9d35b290fc2170ba4654fa9ffbc2479 # Parent 20a391cab5baae0a19e8b96333f6725218578bdb Introduced a separate "unfinalisation" stage to avoid mixtures of old and new attribute information. diff -r 20a391cab5ba -r 4435e910a9d3 micropython/__init__.py --- a/micropython/__init__.py Sun Nov 22 23:34:04 2009 +0100 +++ b/micropython/__init__.py Sun Nov 22 23:53:30 2009 +0100 @@ -415,6 +415,13 @@ if self.finalised: return + # Reset any previously compiled information. + + for module in self.get_modules(): + module.unfinalise() + + # Prepare module information again. + for module in self.get_modules(): module.finalise() diff -r 20a391cab5ba -r 4435e910a9d3 micropython/data.py --- a/micropython/data.py Sun Nov 22 23:34:04 2009 +0100 +++ b/micropython/data.py Sun Nov 22 23:53:30 2009 +0100 @@ -264,13 +264,10 @@ l[attr.position] = attr return l - def finalise_attributes(self, reset=0): + def finalise_attributes(self): "Make sure all attributes are fully defined." - if reset: - self.unfinalise_attributes() - if self.finalised: return @@ -713,13 +710,10 @@ return NamespaceDict.get_updated_context_values(self, results) - def finalise_attributes(self, reset=0): + def finalise_attributes(self): "Make sure that all attributes are fully defined." - if reset: - self.unfinalise_attributes() - if self.finalised: return @@ -1148,7 +1142,7 @@ return 1 return 0 - def finalise_attributes(self, reset=0): + def finalise_attributes(self): """ Make sure all attributes (locals) are fully defined. Note that locals @@ -1156,9 +1150,6 @@ Defaults are also finalised by this method. """ - if reset: - self.unfinalise_attributes() - if self.finalised: return diff -r 20a391cab5ba -r 4435e910a9d3 micropython/inspect.py --- a/micropython/inspect.py Sun Nov 22 23:34:04 2009 +0100 +++ b/micropython/inspect.py Sun Nov 22 23:53:30 2009 +0100 @@ -230,12 +230,19 @@ if isinstance(value, Class): self.vacuum_object(value, 1) + def unfinalise(self): + + "Reset finalised information for the module." + + for obj in self.all_objects: + obj.unfinalise_attributes() + def finalise(self): "Finalise the module." for obj in self.all_objects: - obj.finalise_attributes(reset=1) + obj.finalise_attributes() def add_object(self, obj, any_scope=0):