# HG changeset patch # User Paul Boddie # Date 1490489231 -3600 # Node ID 00345bd10e178977fb012b7b93f9237d4f6a2cae # Parent 1b4aed5f6dba307e2fcc125d2f5c01ace15d12e2 Detect names assigned locally that have already been used in a namespace. diff -r 1b4aed5f6dba -r 00345bd10e17 inspector.py --- a/inspector.py Sun Mar 26 01:18:46 2017 +0100 +++ b/inspector.py Sun Mar 26 01:47:11 2017 +0100 @@ -1249,7 +1249,13 @@ "Set the local with the given 'name' and optional 'ref'." - locals = self.function_locals[self.get_namespace_path()] + path = self.get_namespace_path() + locals = self.function_locals[path] + used = self.names_used.get(path) + + if not locals.has_key(name) and used and name in used: + raise InspectError("Name %s assigned locally but used previously." % name, path) + multiple = not ref or locals.has_key(name) and locals[name] != ref locals[name] = multiple and Reference("") or ref