# HG changeset patch # User Paul Boddie # Date 1474575641 -7200 # Node ID e93137c0f722f264b70a42bc396d81deca6e77ca # Parent bf07fa820dd1b7d18ed589599e6df8d97d938cc0 Forbid assignment to self. diff -r bf07fa820dd1 -r e93137c0f722 inspector.py --- a/inspector.py Thu Sep 22 22:15:50 2016 +0200 +++ b/inspector.py Thu Sep 22 22:20:41 2016 +0200 @@ -325,6 +325,8 @@ # Names and attributes are assigned the entire expression. if isinstance(n, compiler.ast.AssName): + if n.name == "self": + raise InspectError("Redefinition of self is not allowed.", self.get_namespace_path(), n) name_ref = expr and self.process_structure_node(expr)